Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

webmethod is not firing in my application im using autocompleteextender

$
0
0

my code is in aspx


<asp:TextBox ID="txtCtysearch" runat="server" CssClass="TextBox" autocomplete="off"
></asp:TextBox>

<asp:AutoCompleteExtender ID="txtCtysearch_AutoCompleteExtender" runat="server"
MinimumPrefixLength="1" EnableCaching="true"
CompletionSetCount="1" CompletionInterval="1000" ServiceMethod="GetCompletionList"
TargetControlID="txtCtysearch" >
</asp:AutoCompleteExtender>

my code in .cs

[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static List<string> GetCompletionList(string prefixText)
{
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["Connection"].ToString());
con.Open();
SqlCommand cmd = new SqlCommand("select * from COUNTRY_NAME where COUNTRY_NAME like @Name+'%'", con);
cmd.Parameters.AddWithValue("@Name", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> COUNTRY_NAME = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
COUNTRY_NAME.Add(dt.Rows[i][1].ToString());
}
return COUNTRY_NAME;
}
}


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>