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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the dataSource with urlAdaptor?

Thread ID:





143054 Mar 2,2019 12:57 AM UTC Mar 4,2019 09:14 AM UTC ASP.NET MVC - EJ 2 1
Tags: DropDownList
Juan Cruz
Asked On March 2, 2019 12:57 AM UTC

Hi, I want to make a DropDownList with the dataSource from UrlAdaptor. I start using JS2, and I do not know if it is configured the same as JS1
I have my code here:

        .Fields(new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings
            Text="Titulo", Value="AlbumId"

public ActionResult Albums()
            var result = read.GetAlbums();
            var count = result.Count;

            return Json(new { result = result, count = count }, JsonRequestBehavior.AllowGet);

I have two other questions
a) When configuring JS2 and adding the namespaces of Syncfusion.EJ2 in web.config (following the instructions in the documentation), when I try to use a control I can because I get a message saying that I am missing a reference and I always have to put at the start of my .cshtml @using Syncfusion.EJ2
Why is this happening?

b)If in my MVC project I have areas, how can I be able to in ds.Url ("/ JS2 / Albums") to add an area? Or is it not necessary to add the area?
Thanks in advance

Christopher Issac Sunder K [Syncfusion]
Replied On March 4, 2019 09:14 AM UTC

Hi Juan, 

Thank you for contacting Syncfusion support. 

We already have documentation for datasource with url Adaptor. Please refer the below code snippet and the documentation, 
code snippet
<div id='url-data' class='col-lg-6' style='padding-top:15px'>  
    <div class='content'>  
    @Html.EJS().DropDownList("games").Placeholder("Select a Country").PopupHeight("200px").DataSource(dataManger => dataManger.Url("/DropDownList/UrlDatasource").Adaptor("UrlAdaptor").CrossDomain(true)).Fields(new ComboBoxFieldSettings { Value = "ShipCountry" }).Render()  

public IActionResult 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(Data); 

Regarding ej2 sample configuration. Please refer to the below documentation, 

Please let us know if you require any further assistance. 



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