AutoCompleteExtender被解聘,web服务返回结果,但这些都没有显示 [英] AutoCompleteExtender is firing, webservice is returning results, but these are not being displayed

查看:222
本文介绍了AutoCompleteExtender被解聘,web服务返回结果,但这些都没有显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在敲我的头靠在桌子上这一个。

我添加了一个AutoCompleteExtender到我的网页,并已实施了它来调用web服务方法。到目前为止,一切都很好。

使用招,我都检查了,在调试的时候,web服务方法被调用并返回结果我希望看到..但没有被渲染到屏幕上,没有下拉?

能否有人在这里有什么建议,我可能做错了,或者提供建议的一些尝试,因为我目前难倒:

在AutoCompleteExtender在网页宣言:

< CC1:AutoCompleteExtender =服务器ID =lookupAgencyAppSettingName
   的TargetControlID =txtAgencyAppSettingNameServiceMethod =GetListOfSettings结果
   ServicePath =〜/认证/ AJAXMethods.asmx最低prefixLength =1
   CompletionInterval =500EnableCaching =真/>

为了完整起见,这里是web服务方法:

  [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    公共字符串[] GetListOfSettings(字符串prefixText,诠释计数)
    {
        字符串[] = suggestedSettings新的字符串[0];
        清单<串GT; settingNames =新的List<串GT;();
        清单< AgencyApplicationClientSetting>设置= AgencyApplicationClientSetting.All()了ToList< AgencyApplicationClientSetting>();
        的foreach(在设置AgencyApplicationClientSetting设置)
        {
            如果((setting.SettingName.ToLower()StartsWith(prefixText.ToLower()))及。&放大器;!(settingNames.Contains(setting.SettingName)))
            {
                settingNames.Add(setting.SettingName);
            }
        }
        如果(settingNames.Count大于0)
        {
            suggestedSettings = settingNames.ToArray();
        }
        返回suggestedSettings;
    }


解决方案

好吧,这到底变成了(有点恼人)的Z-index时间。
我不知道什么样的z-index正在使用AjaxControlToolkit的ModalPopupExtender显示默认情况下(最高的z-index我可以在网页上看到的是10001)给出的对话框..但幕后的某处它被赋予的属性这意味着,我的弹出建议(从AutoCompleteExtender)总是呈现对话框后面(看不出这可是直到我回到足够的结果得到的建议从对话框下方apepar)。
最后,我不得不重写作为由ModalPopupExtender和一个对话框AutoCompleteExtender的CompletionListCssClass因此面板的z-index:

  .popUpDialog
        {
            的z-index:99重要;
        }        .autoComplete_listMain
        {
            的z-index:2147483647重要;!
            背景:#FFFFFF;
            边界:2px的固体#808080;
            颜色:#000000;
        }

总之,到底烦人简单,但想我会分享以防万一别人运行到类似的问题!

I have been banging my head against the desk over this one.

I have added a AutoCompleteExtender to my webpage, and have implemented the webservice method for it to call. So far, so good.

Using Fiddler, I have checked that, when debugging, the webservice method is being called and is returning the results I'd expect to see.. but nothing gets rendered to the screen, there is no drop down?

Can anyone here suggest what I might have done wrong, or offer a suggestion for something to try as I am currently stumped:

Declaration of the AutoCompleteExtender in the webpage:

<cc1:AutoCompleteExtender runat="server" ID="lookupAgencyAppSettingName" TargetControlID="txtAgencyAppSettingName" ServiceMethod="GetListOfSettings"
ServicePath="~/Authenticated/AJAXMethods.asmx" MinimumPrefixLength="1" CompletionInterval="500" EnableCaching="true" />

For completeness, here is the Webservice Method:

[System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public string[] GetListOfSettings(string prefixText, int count)
    {
        string[] suggestedSettings = new string[0];
        List<string> settingNames = new List<string>();
        List<AgencyApplicationClientSetting> settings = AgencyApplicationClientSetting.All().ToList<AgencyApplicationClientSetting>();
        foreach(AgencyApplicationClientSetting setting in settings)
        {
            if((setting.SettingName.ToLower().StartsWith(prefixText.ToLower())) && (!settingNames.Contains(setting.SettingName)))
            {
                settingNames.Add(setting.SettingName);
            }
        }
        if(settingNames.Count > 0)
        {
            suggestedSettings = settingNames.ToArray();
        }
        return suggestedSettings;
    }

解决方案

Okay, in the end this turned out (somewhat annoyingly) a z-index time. I'm not sure what z-index a dialog that is displayed using the AjaxControlToolkit's ModalPopupExtender is given by default (the highest z-index I could see on the page was 10001).. but somewhere behind the scenes it was being given an attribute that meant that my popup suggestions (from the AutoCompleteExtender) always rendered behind the dialog (couldn't see this however until I returned enough results to get the suggestions apepar from beneath the dialog). In the end I had to override the z-index of the panel used as a dialog by the ModalPopupExtender AND the CompletionListCssClass of the AutoCompleteExtender thus:

            .popUpDialog
        {
            z-index: 99 !important;
        }

        .autoComplete_listMain
        {
            z-index: 2147483647 !important;
            background: #ffffff;
            border: solid 2px #808080;
            color: #000000;
        }

Anyway, annoyingly simple in the end, but thought I'd share just in case anyone else runs into a similar problem!

这篇关于AutoCompleteExtender被解聘,web服务返回结果,但这些都没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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