Click here to Skip to main content
15,908,841 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a master page and in content place holder i have a text box where i am using auto complete extender.But its not working can you guide me. if nay one have idea ?
Aspx page code:

XML
<asp:TableCell HorizontalAlign="Left">
                           Subject Name:<asp:TextBox ID="txtSubject" runat="server"></asp:TextBox><img id="loading" style="visibility:hidden" src="~/Images/Wait.gif" />
                           <ajax:AutoCompleteExtender ID="AutoCompleteExtender1" EnableCaching="true"
                               BehaviorID="AutoCompleteEx" TargetControlID="txtSubject"
                               ServiceMethod="Getsubjects" MinimumPrefixLength="1"
                               CompletionSetCount="1" CompletionInterval="1000"
                               runat="server" FirstRowSelected="true">
                           </ajax:AutoCompleteExtender>
                           <!-- <asp:DropDownList ID="ddlSubject" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSubject_SelectedIndexChanged"
                       Width="140px" CssClass="asp_dropdown">
                   </asp:DropDownList>-->
                       </asp:TableCell>



Behind code:
XML
[System.Web.Script.Services.ScriptMethod()]
    [System.Web.Services.WebMethod]
    public List<string> Getsubjects(string prefixText)
    {
        DataSet ds = new DataSet();
        ds = PopulateSubjects(prefixText);
        DataTable dt = ds.Tables["ResultSet"];
        List<string> SbujectNames = new List<string>();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            SbujectNames.Add(dt.Rows[i][1].ToString());
        }
        return SbujectNames;
    }
Posted

1 solution

I couldn't see ToolkitScriptManager on your code base.Check that.

XML
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>


Any way try below sample.It explains very well.

http://www.asp.net/ajaxlibrary/act_autocomplete_simple.ashx[^]

I hope this will help to you.
 
Share this answer
 
Comments
krranjeet9 10-Jul-13 0:52am    
Hi sampath

I have registered with tool kit. which is below and still i ma facing same problem.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
Sampath Lokuge 10-Jul-13 3:18am    
@krranjeet9 Before you can use any of the Ajax Control Toolkit controls in a page, you first need to add a ToolkitScriptManager to the page. You can drag the ToolkitScriptManager from the Visual Studio Toolbox window onto the page. The ToolkitScriptManager is located in the Ajax Control Toolkit tab under the Toolbox.You have to do this step also. Plz check the article I have shared with you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900