Follow by Email

Saturday, May 4, 2013

using ajax autocomplete extender in

Hello in this post i will show how to use ajax autocomplete extender in

1. Add ajaxtoolkit namepace in the header of the aspx page.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

2. Then add textbox control , Ajax ToolkitScriptManager, Ajax AutoCompleteExtender controls to the aspx page.

3. Below is code after adding all the controls :

    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>  
    runat="server" ServiceMethod="GetSearchList" UseContextKey="True" />  

4. In the codebehind we will write the code for GetSearchList method. This method signature we enter into  the autocompleteextender ServiceMethod property.

Above the method name we will write and method should be static.

**This method signature and the method description we can also auto generate as show below:
Click on Add AutoComplete Page method

In the method im using a linq query which will return me the result set of the all the words starting with the entered text in the textbox.

5. Run the project to check the Final Result