Thursday, May 19, 2011

AJAX AutoComplete Feature Implementation Example

1.       Add AJAXControltoolkit dll in your web site reference
2.       Drag n drop script manager on the top of the page (if already included inmaster page then no need)
3.     Place folowing html in your html page

<ajaxToolkit:AutoCompleteExtender ID="AutoCompletePeople" runat="server" TargetControlID="txtUsers " 
DelimiterCharacters=","  MinimumPrefixLength="1" ServicePath="NewQuestion.aspx"
ServiceMethod="GetUsersList" UseContextKey="True"

4.      Write following code in aspx.cs class file
#region AutoComplete Users
        //Specify this method as ServiceMethod for Company Completion List
        public static string[] GetUsersList(string prefixText, int count)
            string[] result = selectUsers(prefixText);// this method returns all the users
            return result;
        #endregion  AutoComplete Users END

Here is the link for AJAX  Auto complete features  and more

No comments:

Post a Comment