Dropdown List Displaying Twice

I am building a cascading dropdown list and when I add the change function it is displaying the dropdown list twice.  Right now my function doesn't do any logic just pop up a message that it fired.

Here is the code for the dropdown list:

                <ejs-dropdownlist id="addFieldObjectTypeDropdown" change="loadFieldNameList2">

                    <e-data-manager url="/LookupValue/ObjectTypeList" adaptor="WebApiAdaptor"></e-data-manager>

                </ejs-dropdownlist>

Here is the code for loadFieldNameList2:

    function loadFieldNameList2() {

        alert("Change fired");

    }

Here is the code from my controller (I get the same result if I use a list in the ViewBag too):

        public List<string> ObjectTypeList()

        {

            int companyID = 3;

            int organizationID = 1;


            List<string> objectTypes = new List<string>();


            var lookupValues = _context.LookupFieldValues

                .Where(i => i.CompanyId == companyID)

                .Where(i => i.OrganizationId == organizationID)

                .Where(i => i.ObjectType == "Base")

                .Where(i => i.FieldName == "Object")

                .Select(i => new { i.FieldValue })

                .ToList();


            foreach (var objectType in lookupValues)

            {

                objectTypes.Add(objectType.FieldValue);

            }


            return (objectTypes);

And here is an image of the result (you can see the two Object Type dropdowns - if I remove the  change="loadFieldNameList2" it displays correctly:


How do I get rid of the double dropdown?

Thanks

- Ken


2 Replies

KK Ken Kitts August 26, 2021 01:54 PM UTC

You can ignore this, I found the problem.  It have multiple dialog boxes on this page and had a dropdownlist with the same ID in another dialog.  That was the problem.


Thanks

- Ken



BC Berly Christopher Syncfusion Team August 26, 2021 02:41 PM UTC

Hi Ken, 
  
We are glad to know that the issue is resolved in your end. Please let us know if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon