Autocomplete for two Textboxs [Resolved]

Posted by Jenniffer under C# on 4/2/2013 | Points: 10 | Views : 1422 | Status : [Member] | Replies : 7
I want 2 autocomplete textboxs in single aspx page.... first autocomplete textbox is working but second textbox is not working... Is this possible???? please let me know if possible.... Thank u........

Thanks & Regards
JENI



Responses

Posted by: Jayakumars on: 4/2/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi try this

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



Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/3/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi
try this code


try this working Good

Webservice Code
====================

[WebMethod]
public List<string> GetCountries(string prefixText)
{
List<string> CountryNames = new List<string>();
return CountryNames;
}


Client Side
======================

<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>

<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCountry" ServicePath="WebService.asmx"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000" ServiceMethod="GetCountries">
</asp:AutoCompleteExtender>



<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" TargetControlID="TextBox1" ServicePath="WebService.asmx"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000" ServiceMethod="GetCountries"></asp:AutoCompleteExtender>

Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/2/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
http://www.asp.net/ajaxlibrary/act_AutoComplete_Simple.ashx
http://www.c-sharpcorner.com/UploadFile/b19d5a/autocomplete-textbox-using-database-return-value-in-Asp-Net/

or post your code

Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 4/2/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://www.aspdotnet-suresh.com/2012/08/using-jquery-autocomplete-with-aspnet.html
http://www.dotnetcurry.com/ShowArticle.aspx?ID=515


If this post helps you mark it as answer
Thanks

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jenniffer on: 4/3/2013 [Member] Starter | Points: 25

Up
0
Down
I have done all these steps....But still it's not working.....

Thanks & Regards
JENI

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jenniffer on: 4/3/2013 [Member] Starter | Points: 25

Up
0
Down
I have done one small mistake in autocomple extender i have added BehaviourId... BehaviourId should be unique or No need of BehaviourId.... Thanks i got the output....

Thanks & Regards
JENI

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 4/3/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

post ur Code here


Mark as Answer if its helpful to you

Jenniffer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response