Click here to Skip to main content
15,891,839 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi friends,

AJAX AutoComplete Extender Not working in ModalPopUpExtender

The Page method is returning the values but AutoComplete suggestion is not showing.

XML
<asp:TextBox runat="server" ID="txtCity" Width="200px" />
                                                       <Mp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCity"
                                                           MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
                                                           ServiceMethod="SearchCities">
                                                       </Mp:AutoCompleteExtender>


Code behind code :

XML
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> SearchCities(string prefixText, int count)
{
    Util utility = new Util();
    List<string> CityList = new List<string>();
    CityList = utility.GetCities(prefixText);
    return CityList;
}
Posted
Updated 1-Mar-17 22:50pm

try using the UpdatePanel
place the TextBox or modal PopUp inside it and set the trigger properties
XML
<asp:updatepanel id="UP1" runat="server" updatemode="Conditional" childrenastriggers="false" xmlns:asp="#unknown">
<triggers>
<asp:asyncpostbacktrigger controlid="txtcity"" eventname="textchange" /></triggers>
 
Share this answer
 
v3
Hi All
Create a java script function as mentioned below
function PopupShown(sender, args) {
         sender._popupBehavior._element.style.zIndex = 99999999;
     }


use property
OnClientShown="PopupShown" as shown below


<sgg:AutoCompleteExtender ServiceMethod="SearchExpenseHead" MinimumPrefixLength="3"
CompletionListCssClass="AutoCompleteFlyout" CompletionListHighlightedItemCssClass="AutoCompleteFlyoutHilightedItem"
CompletionListItemCssClass="AutoCompleteFlyoutItem" CompletionInterval="10" EnableCaching="false" CompletionSetCount="4" TargetControlID="txtExpenseHead" ID="AutoCompleteExtender1" OnClientShown="PopupShown" runat="server" FirstRowSelected="false"></sgg:AutoCompleteExtender>


It must work
thanks
pavan pandey
 
Share this answer
 
Comments
CHill60 2-Mar-17 4:45am    
3 years late
Just looking at your code, I can see redundant code and a simplification. You don't need to initialize the list like that as the list will be automatically filled by the Function's returned values.

So this:
C#
List<string> CityList = new List<string>();
CityList = utility.GetCities(prefixText);
return CityList;
becomes:
C#
var CityList = utility.GetCities(prefixText);
return CityList;
and can be simplified further:
C#
return utility.GetCities(prefixText);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900