自动填充扩展器无法正常工作 [英] Autocomplete extender not working

查看:96
本文介绍了自动填充扩展器无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



自动填充扩展程序在firebug中返回以下错误。



Hi all,

Autocomplete extender returning the following error in firebug.

{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}





我的方法是asmx文件:





My method is asmx file:

[WebMethod]
   public static List<string> SearchCities(string prefixText,int count, string contextKey)
   {
       Util utility = new Util();
       List<string> CityList = new List<string>();
       CityList = utility.GetCities(prefixText,contextKey);
       return CityList;
   }










<asp:TextBox runat="server" ID="txtOfficeCity" onkeyup="SetOfficeContextKey()" />
                                                                                                            <asp:HiddenField ID="hfOfficeCityCode" runat="server" />
                                                                                                            <cc1:AutoCompleteExtender

                                                                                                                runat="server" ID="Auto2"

                                                                                                                TargetControlID="txtOfficeCity"

                                                                                                                EnableCaching="true"

                                                                                                                CompletionListCssClass="completionList"

                                                                                                                CompletionListItemCssClass="listItem"

                                                                                                                CompletionListHighlightedItemCssClass="itemHighlighted"

                                                                                                                ServiceMethod="SearchCities"

                                                                                                                ServicePath="AutoComplete.asmx"

                                                                                                                OnClientItemSelected="ClientOfficeCitySelected"

                                                                                                                MinimumPrefixLength="1"

                                                                                                                UseContextKey="true"

                                                                                                                CompletionInterval="10"

                                                                                                                 CompletionSetCount="12">
                                                                                                            </cc1:AutoCompleteExtender>







Javascript methods for setting and getting the context keys.




Javascript methods for setting and getting the context keys.

function SetOfficeContextKey() {
           $find("<%=Auto2.ClientID %>").set_contextKey($get("<%=ddlCountryOffice.ClientID %>").value);
       }

function ClientOfficeCitySelected(sender, e) {
           debugger;
           $get("<%=hfOfficeCityCode.ClientID %>").value = e.get_value();
       }

推荐答案

find(\"<%=Auto2.ClientID %>\").set_contextKey(
find("<%=Auto2.ClientID %>").set_contextKey(


get(\"<%=ddlCountryOffice.ClientID %>\").value);
}

function ClientOfficeCitySelected(sender, e) {
debugger;
get("<%=ddlCountryOffice.ClientID %>").value); } function ClientOfficeCitySelected(sender, e) { debugger;


get(\"<%=hfOfficeCityCode.ClientID %>\").value = e.get_value();
}
get("<%=hfOfficeCityCode.ClientID %>").value = e.get_value(); }


这篇关于自动填充扩展器无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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