Hi,
Auto Complete extender is not working properly in visual studio 2005.I am using the following code :-
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtentername" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="10" CompletionInterval="100" ServiceMethod="GetCountries">
</cc1:AutoCompleteExtender> Below is the code for code behind section :-
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetCountries(string prefixText)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Thyrocare"]);
SqlCommand cm;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cm = new SqlCommand(" select * from Patientdetails where Patientname like @Name+'%'", con);
cm.Parameters.AddWithValue("@Name", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cm);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> CountryNames = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
CountryNames.Add(dt.Rows[i][1].ToString());
}
return CountryNames;
} I am not getting any kind of error though the list is not coming in the textbox.
Kindly share your ideas regarding the same.