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