Expander autocomplete in text field without using webservice

I do not want to use a web service to fill in autocomplete in a text box. In this case, when the user enters the name of the country, and I do not want to travel to the database every time. I would rather keep the collection in session state and "bind" autocomplete to this.

Is it possible to install ServicePath and / or ServiceMethod on something in the code, and not on the webservice?

Kumar Relations

+3
source share
4 answers

Unfortunately, there is no direct opportunity to do this, other than hacking into javascript to stop the browser from being called to get a list.

, , - - EnableCaching AutoCompleteExtender, , - , webservice (, , ).

: , , WebMethod ServicePath aspx.

., - http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx

, . , , -.

+1

? -, . , .

HTML, Javascript .

0

asmx - . , , , . -, .

0

onclientpopulating javascript, , onclientpopulating = "onPopulating", js , -. - , , -. completeData , , , . . , , -, .

    function onPopulating(ace, args)
    {
       var prefixText = ace._currentCompletionWord();
       var filteredItems = GetFilteredItems(prefixText);
       ace._update(prefixText,filteredItems,false);
       args.set_cancel(true);

    }

    function GetFilteredItems(prefixText)
    {
        var filteredItems = []; 
        for (var nCount=0; nCount < completionData.length; nCount ++)
        {
            if (completionData[nCount].startsWith(prefixText))
            {
                Array.add(filteredItems,completionData[nCount]);

            }
        }
        return filteredItems; 
    }
0

Source: https://habr.com/ru/post/1736440/


All Articles