本文介绍了Ajax AutoComplete Extender在母版页中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ajax autocomplete extender..autocomplete与内容页面合作很好..但不能在母版页面上工作..



这是我的代码:



Html页面:



Am Working with ajax autocomplete extender..autocomplete woking fine with content pages..But not working in master Page..

Here Is My Code:

Html Page:

<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"   CompletionSetCount="12">
        </ajax:AutoCompleteExtender>





和我的webService IS:





And My webService IS:

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;
   }

推荐答案



这篇关于Ajax AutoComplete Extender在母版页中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 18:07