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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

146334 Jul 31,2019 07:24 PM UTC Aug 2,2019 02:09 PM UTC ASP.NET Core - EJ 2 4
loading
Tags: Dropdown List
Aaron Knipe
Asked On July 31, 2019 07:24 PM UTC

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?




Ashokkumar Balasubramanian [Syncfusion]
Replied On 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. 


Aaron Knipe
Replied On August 1, 2019 01:31 PM UTC

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

Aaron Knipe
Replied On August 1, 2019 01:57 PM UTC

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



Narayanasamy Panneer Selvam [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon