Hi Randy,
Sorry for the inconvenience caused. We are able to reproduce the specified issue. We have confirmed this as bug (“while setting the “selectedItemIndex” property value as -1 in dropdownlist, the dropdown value must be an empty and while setting the “selectedItemIndex” property as null, it throws an error.”) and an issue report has been logged on this. If you are in need of a solution sooner we can also provide a custom patch for this within 15days.
As a workaround solution, Instead of specify the “selectedItemIndex” property value in the control creation, we have set the index variable value as -1 and checked the condition with that value. In this, we have to manually empty the dropdown value when the index variable value -1 otherwise the index value is set to the “selectedItemIndex” property as shown below,
[Index.cshtml] <script type="text/javascript"> var target; $(function () { var index = -1; var target = $("#bikeList").data("ejDropDownList"); if (index > -1) target.option("selectedItemIndex",index) else target.option("value", ""); }); |
Also we have prepared the sample based on this and it is available under the following location,
Sample location: Sample
Kindly let us know if you have any queries.
Regards,
Kasithangam