We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

SelectItemByValue does not work when using the WebApiAdaptor

I am developing a MVC5 web application and  populating a dropdownlist control  using the WebApiAdaptor to make a REST call. 
When I try and select an item it does not select it.

Below is the code I am using to populate and select a value in the dropdown control.

//Page loaded
    $(function ()
            dataSource: ej.DataManager({
                url: "GetStatusType",                
                adaptor: new ej.WebApiAdaptor()
            fields: { text: "Name", value: "Code" }            

Are you able to tell me where I am going wrong?


1 Reply

KR Keerthana Rajendran Syncfusion Team August 25, 2016 12:00 PM UTC

Hi Mahindra  
We had checked your code. We found that you have tried to select an item by value before data has been bound to dropdownlist. We suggest you to use this selectItemByValue in actionComplete event which will be triggered after data is bound to dropdownlist.   
$(function() {   
            dataSource: ej.DataManager({   
                url: "/api/Orders",   
                adaptor: new ej.WebApiAdaptor()   
            fields: {   
                text: "CustomerID",   
                value: "CustomerID"   
                var ddlobj = $("#drpStatus").data("ejDropDownList")   
We have prepared a sample please find in the below link.  
Please let us know if any concern   


Live Chat Icon For mobile
Up arrow icon