saravana kumar

saravana kumar

  • NA
  • 31
  • 46.1k

Ajax Auto Complete Extender not Working in master Page?

May 4 2013 4:51 PM

Here Is My HTML Code:

    <ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
        <asp:TextBox ID="txtAutoComplete" ClientIDMode="Static" runat="server" />
        <ajax:AutoCompleteExtender ID="AutoCompleteExtender1" Enabled="true" runat="server" DelimiterCharacters=""
             ServicePath="Autocomplete.asmx" ServiceMethod="GetAutoCompleteData"
            TargetControlID="txtAutoComplete" MinimumPrefixLength="1"  CompletionInterval="10"
            EnableCaching="true"  UseContextKey="false" CompletionSetCount="12">
        </ajax:AutoCompleteExtender>


And Here Is MY WebService:

          [WebMethod]
    //[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public List<string> GetAutoCompleteData(string Word)
    {
        List<string> result = new List<string>();
        string connection = ConfigurationManager.ConnectionStrings["alayoosainews"].ConnectionString;
        SqlConnection con = new SqlConnection(connection);
        con.Open();
        //SqlCommand cmd = new SqlCommand("select distinct moviename,year from moviedetails where moviename LIKE '%'+@SearchText+'%'", con);
        // SqlCommand cmd = new SqlCommand("select moviename,year,charname from moviedetails,character where moviename like '%'+@SearchText+'%' and charid in( select item from fnSplit(listofcharacters,',') )", con);
        SqlCommand cmd = new SqlCommand("GetSearchNews", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@lang", "ta");
        cmd.Parameters.AddWithValue("@word", Word);
        SqlDataReader dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            // result.Add("<a href=NewsDetails.aspx?newsid=" + dr[0].ToString() + ">" + dr[1].ToString() + "</a>");
            result.Add(dr[1].ToString());
            // result.Equals(dr["moviename"].ToString());
            /// result.Add(dr["year"].ToString());
        }
        return result;
    }

Can Anyone help   me?

Answers (2)