AJAX AutoComplete Extender在ModalPopUpExtender中不起作用 [英] AJAX AutoComplete Extender Not working in ModalPopUpExtender

查看:77
本文介绍了AJAX AutoComplete Extender在ModalPopUpExtender中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



Hi friends,

AJAX AutoComplete Extender Not working in ModalPopUpExtender



Page方法返回值,但不显示自动完成建议。




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

<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 :

[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;
}

推荐答案

尝试使用 UpdatePanel

在其中放置 TextBox 或模态 PopUp 并设置触发器属性
try using the UpdatePanel
place the TextBox or modal PopUp inside it and set the trigger properties
<asp:updatepanel id="UP1" runat="server" updatemode="Conditional" childrenastriggers="false" xmlns:asp="#unknown">
<triggers>
<asp:asyncpostbacktrigger controlid="txtcity"" eventname="textchange" /></triggers>


大家好

创建如下所述的java脚本函数

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>





必须工作

谢谢

pavan pandey



It must work
thanks
pavan pandey


只需查看代码,我就可以看到冗余代码和简化。您不需要像这样初始化列表,因为列表将由函数的返回值自动填充。



所以这个:
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:
List<string> CityList = new List<string>();
CityList = utility.GetCities(prefixText);
return CityList;

变为:

var CityList = utility.GetCities(prefixText);
return CityList;

并且可以进一步简化:

return utility.GetCities(prefixText);


这篇关于AJAX AutoComplete Extender在ModalPopUpExtender中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆