Home > DeveloperSection > Forums > AutoComplete Controller Action not being called
Simons Hood
Simons Hood

Total Post:70

Posted on    November-27-2014 10:40 PM

 ASP.Net Controller  Autocomplete 

 1 Reply(s)
 835  View(s)
Rate this:

I have a editbox which is linked to auto-complete handler, when I type any character the controller method itself not calling and its not even working also.





    minChars: 3,

    delay: 100,

    cacheLength: 25,

    autoFill: true,

    source: function (request, response) {


            url: "/Data/GetNames", dataType: "json",

            data: { id: request.term },

            success: function (data) {

                response($.map(data, function (item) {

                    return { label: item.label, value: item.id }; //updated code





    select: function (event, ui) {

        return false;



Here is the controller method.




[RequiresRole(Roles = "su, da, rv, sp, dg, ap, ua")]


public string GetNames(string term )


    //perform DB operations

    return String.Empty;




<input type="text" name="NameInput" id="NameInput" class="NameInputField" maxlength="80" tabindex="3" />

Here getNames method itself not calling, at the time of launching I'm just registering for auto-complete handler. What will be the issue?

Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    November-28-2014 7:04 AM

As far as I can see, the issue lies in your ajax call. In the data in you pass, you assign request.term to id - yet your controller method is looking for a parameter called term.


Change your ajax from


data: { id: request.term }



data: { term: request.term }

Alternatively, change your controller method from


public string GetNames(string term)



public string GetNames(string id)

Don't want to miss updates? Please click the below button!

Follow MindStick