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

Autocomplete with URL datasource doesn't work


I'm testing binding an  autocomplete control with url adaptor, but I can not make it work.

Binding with viewbag works perfectly.

I attach an example

Attachment: AutocompleteExample_731f978c.zip

3 Replies

SS Selvamani Sankarappan Syncfusion Team April 21, 2017 09:46 AM UTC

Hi Manolo,   
We have checked your shared sample, but we were unable to reproduce the reported issue. The data is bounded to the Autocomplete using the URL Adaptor and it is working in your shared sample. Please refer to the following video:   
If you still face any difficulties, kindly get back to us with more details to reproduce the issue. We will provide an appropriate solution at the earliest.   
Selvamani S.   

MA Manolo April 21, 2017 10:07 AM UTC


In my example, when I use autocomplete with datasource binding with the viewbag, it works fine

But when I use URL Adaptor, I get this

I'm filtergin for Au, but it show all data

SS Selvamani Sankarappan Syncfusion Team April 24, 2017 09:21 AM UTC

Hi Manolo,   
Thanks for the update.   
If data is bound to Autocomplete using URL Adaptor, the URL Adaptor fetches all data. So, you need to filter the text manually using our existing client side event change of Autocomplete. Refer to the following code example:   
public JsonResult GetDataCar(string data)   
            var data1 = GetData();   
            if (data != null)   
                var search = from n in data1 wheren.text.ToLower().StartsWith(data.ToLower()) select n;   
                return Json(search,JsonRequestBehavior.AllowGet);   
                return Json(data1,JsonRequestBehavior.AllowGet);    
<div class="control">   
            <span class="txt">URL Adaptor - No work</span>   
            @Html.EJ().Autocomplete("delimit2").Datasource(ds => ds.URL(Url.Action("GetDataCar","Autocomplete")).Offline(true).Adaptor(AdaptorType.UrlAdaptor)).Width("225").MultiSelectMode(MultiSelectModeTypes.Delimiter).ShowPopupButton(true).Delimiter(",").EnableRTL(false).ClientSideEvents(e=>e.Change("change"))   
function change(args) {   
                url: "GetDataCar",   
                data: { data: args.value },   
                type: 'POST',   
                dataType: "json",   
                success: function(result) {   
                    console.log("event triggered");   
We have modified your sample based on your requirement. Refer to the following sample:   
Please let us know if you need further assistance.   
Selvamani S. 

Live Chat Icon For mobile
Up arrow icon