AutoCompleteExtender Works Only After Postback

Posted by Sharpcnet under C# on 11/27/2013 | Points: 10 | Views : 2060 | Status : [Member] | Replies : 5
The AutoCompleteExtender works only after there is a postback. The first time the page loads, and user types in the textbox, it doesnt work. But after there is a postback like checkedChnaged, buttonClick etc, & user types now, the suggestion list shows up. Its like the extender is activated only after postbacks.
ASPX:

<asp:TextBox ID="txtSearch" runat="server" OnTextChanged="txtSearch_TextChanged"
onchange="itemSelected();"></asp:TextBox>
<asp:AutoCompleteExtender ID="ace" runat="server" TargetControlId="txtSearch"
MinimumPrefixLength="2" EnableCaching="true" CompletionSetCount="10"
CompletionInterval="0" ServiceMethod="GetCodes" UseContextKey="True"
CompletionListCssClass="autoComplete"
CompletionListItemCssClass="autoCompleteItem"
CompletionListHighlightedItemCssClass="autoCompleteHL"
>
</asp:AutoCompleteExtender>
CS:

[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static string[] GetCodes(string prefixText)
{
CountryBLL objCountry = new CountryBLL();
return objDAL.GetCodes(prefixText);
}





Responses

Posted by: vishalneeraj-24503 on: 11/27/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Please take Update panel and inside updatepanel copy your Textbox and AutoCompleteExtender control.
please try this.

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

Posted by: vishalneeraj-24503 on: 11/27/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
you can use below links:-
http://weblogs.asp.net/aaronschnieder/archive/2008/03/11/ajaxcontroltoolkit-autocompleteextender-bug-in-an-updatepanel.aspx
http://forums.asp.net/t/1455631.aspx


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

Posted by: Sharpcnet on: 11/27/2013 [Member] Starter | Points: 25

Up
0
Down
The update panel did not work.
It was working good and stopped all of a sudden. I do not know of any changes made to the page.
What makes this work only with postbacks and not on page loads.

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

Posted by: vishalneeraj-24503 on: 11/27/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
then visit below query:-
http://weblogs.asp.net/aaronschnieder/archive/2008/03/11/ajaxcontroltoolkit-autocompleteextender-bug-in-an-updatepanel.aspx
http://forums.asp.net/t/1455631.aspx

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

Posted by: Sharpcnet on: 11/27/2013 [Member] Starter | Points: 25

Up
0
Down
Posted Twice. I wouldnt want to change the dll when I am sure that it worked before.

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

Login to post response