AutoCompleted Multiple TextBox Working

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 1179
server side

protected void Page_Load(object sender, EventArgs e)
{

}

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
//return default(string[]);
string[] movies = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"};

// Return matching movies
return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList1(string prefixText, int count, string contextKey)
{
//return default(string[]);
string[] movies = { "Jehovah Jireh", "Jehovah Ruffa", "Jehovah Nissi", "Jayakumar", "Joshva","Holy Sprit" };

// Return matching movies
return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}

Client Side

Value-I <asp:TextBox ID="txtMovie" runat="server"></asp:TextBox>


<asp:AutoCompleteExtender
ID="AutoCompleteExtender1"
TargetControlID="txtMovie"
runat="server" ServiceMethod="GetCompletionList" UseContextKey="True" />

Value-II <asp:TextBox ID="txtMovie1" runat="server"></asp:TextBox>


<asp:AutoCompleteExtender
ID="AutoCompleteExtender2"
TargetControlID="txtMovie1"
runat="server" ServiceMethod="GetCompletionList1" UseContextKey="True" />

i Refered this url

http://www.asp.net/ajaxlibrary/act_AutoComplete_Simple.ashx

Comments or Responses

Login to post response