I am trying to do auto suggest in a TextBox and I used Ajax controls to do so. I am giving movies array some values. I want to give that value from the database by filtering the user table with the email Id that the User used to Login to the website. I am not able to call the Label value into the method below. I have stored the email id of user in label during page load. help me to do that.
[System.Web.Services.WebMethodAttribute(),System.Web.UI.WebControls, System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
// Create array of movies
string[] movies = {"Joey", "Joester", "Joker", "Joeic", "Joic", "Shrek II"};
// Return matching movies
return (from m in movies where m.StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}
If you are using the AJAX Control Toolkit you can see example here.
I am not sure what is the label about, but you need to set
UseContextKey=true;and specify the context key for theajaxToolkit:AutoCompleteExtenderIn your case you can add the following code to Page.Load: