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

When using a datamanager for a dropdownlist, Error dateParse object not extensible

I am trying to use a DataManager to populate a drop down list on an edit template.  the DataManager is calling a controller action, but the action never fires.  I have tried several variations of return data on the controller including Json(new{Items=items,Count = Count}),  Json(new{items=items,count = Count}), Json(new{result=items,Count = Count}).  Something in the datamanager appears to have a type error as it is failing between my two debug points and not hitting the controller.  Am I missing something or doing something wrong?




4 Replies

AB Ashokkumar Balasubramanian Syncfusion Team August 1, 2019 12:46 PM UTC

 
Hi Aaron Knipe, 
 
Good day to you. 
 
We were unable to reproduce the reported issue at our end and prepared the sample based on your provided code example. 
 
 
<input type="text" id='customers' /> 
 
<script> 
 
// initialize DropDownList component 
 
var dropDownListObj = new ej.dropdowns.DropDownList({ 
 
// bind the DataManager instance to dataSource property 
 
dataSource: new ej.data.DataManager({ 
 
url: '@Url.Action("UrlDatasource", "Home")', 
 
adaptor: new ej.data.UrlAdaptor(), 
 
crossDomain: true 
 
}), 
 
// map the appropriate columns to fields property 
 
fields: { value: 'ShipCountry' }, 
 
// set the placeholder to DropDownList input element 
 
placeholder: 'Select a name', 
 
}); 
 
dropDownListObj.appendTo('#customers'); 
 
</script> 
 
 
[HomeController.cs] 
 
public JsonResult UrlDatasource([FromBody]Data dm) 
 
        { 
 
            var val = OrdersDetails.GetAllRecords(); 
 
            var Data = val.ToList(); 
 
            var count = val.Count(); 
 
            if (dm.where != null) 
 
            { 
 
                Data = (from cust in Data 
 
                        where cust.ShipCountry.ToLower().StartsWith(dm.@where[0].value.ToString()) 
 
                        select cust).ToList(); 
 
            } 
 
            if (dm.take != 0) 
 
                Data = Data.Take(dm.take).ToList(); 
 
            return Json(new { result = Data }); 
 
        } 
 
Sample:  
 
 
Still issue persists, please revert with issue reproducing sample that will help us to check and provide the exact solution at our end. 
 
Regards, 
Ashokkumar B. 



AK Aaron Knipe August 1, 2019 01:31 PM UTC

Is this controller action signature required?
public JsonResult UrlDatasource([FromBody]Data dm) { ... }


AK Aaron Knipe August 1, 2019 01:57 PM UTC

I did find the issue.  The issue is that I needed to declare a new data manager. 




NP Narayanasamy Panneer Selvam Syncfusion Team August 2, 2019 02:09 PM UTC

Hi Aaron, 
Most welcome. 
We are glad to hear that your issue is resolved in your end. 
Regards, 
Narayanasamy P. 


Loader.
Live Chat Icon For mobile
Up arrow icon