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

Autocomplete with URL datasource doesn't work

Thread ID:

Created:

Updated:

Platform:

Replies:

130082 Apr 20,2017 11:04 AM UTC Apr 24,2017 09:21 AM UTC ASP.NET MVC 3
loading
Tags: AutoComplete
Manolo
Asked On April 20, 2017 11:04 AM UTC

Hi,

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

Selvamani Sankarappan [Syncfusion]
Replied On 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.   
   
Regards,   
   
Selvamani S.   


Manolo
Replied On April 21, 2017 10:07 AM UTC

Hi,

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

Selvamani Sankarappan [Syncfusion]
Replied On 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:   
 
[cs]   
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);   
            }   
            else   
            {   
                   
                return Json(data1,JsonRequestBehavior.AllowGet);    
            }   
              
             
        }   
  
   
[cshtml]   
<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"))   
        </div>   
    </div>   
   
[script]   
function change(args) {   
            $.ajax({   
   
                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.   
   
Regards,   
   
Selvamani S. 


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.

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

;