Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# AutoCompleteXtender在share point 2010 web应用程序的用户角色页中不工作_C#_Asp.net - Fatal编程技术网

C# AutoCompleteXtender在share point 2010 web应用程序的用户角色页中不工作

C# AutoCompleteXtender在share point 2010 web应用程序的用户角色页中不工作,c#,asp.net,C#,Asp.net,我们正在开发共享点web应用程序,其中有许多用户控件(ascx)和aspx页面。我的AutoCompleteXtender在aspx页面中工作正常,但当我将代码放在ascx(用户控制)页面中时,它不工作。请帮帮我 我在用户控件中用于自动完成搜索的代码是: <asp:TextBox ID="txtCity" runat="server" onkeyup="SetContextKey()" Style="width: 50px;"></asp:TextBox>

我们正在开发共享点web应用程序,其中有许多用户控件(ascx)和aspx页面。我的AutoCompleteXtender在aspx页面中工作正常,但当我将代码放在ascx(用户控制)页面中时,它不工作。请帮帮我

我在用户控件中用于自动完成搜索的代码是:

 <asp:TextBox ID="txtCity" runat="server" onkeyup="SetContextKey()" Style="width: 50px;"></asp:TextBox>
                <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCity"
                    MinimumPrefixLength="2" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
                    ServiceMethod="GetCity" ServicePath="~/Search.aspx" OnClientItemSelected="setCompanyMasterID"
                    UseContextKey="true" CompletionListCssClass="completionList" CompletionListItemCssClass="listItem"
                    CompletionListHighlightedItemCssClass="itemHighlighted" OnClientPopulated="onListPopulated">
</asp:AutoCompleteExtender>

Java脚本和Css代码是:

    function SetContextKey() {
        $find('<%=AutoCompleteExtender1.ClientID%>').set_contextKey($get("<%=txtTokenID.ClientID %>").value);
    }
    function setCompanyMasterID(source, eventargs) {

        var strIFSC = eventargs.get_value();
        alert(strIFSC);
        var Name = document.getElementById("<%=txtCity.ClientID %>").value;

        alert(Name);
    }
    function onListPopulated() {

        var completionList = $find('<%=AutoCompleteExtender1.ClientID%>').get_completionList();
        completionList.style.width = '200px';

        for (i = 0; i < completionList.childNodes.length; i++) {

            completionList.childNodes[i].title = completionList.childNodes[i]._value;
        }

    }
</script>
<style type="text/css">
    .autocomplete_firstrow
    {
        background-color: Red;
        height: 20px;
    }
    .completionList
    {
        border: solid 1px Gray;
        margin: 0px;
        padding: 3px;
        height: 220px;
        overflow: auto;
        background-color: #888888;
    }
    .listItem
    {
        color: #191919;
    }
    .itemHighlighted
    {
        background-color: #ADD6FF;
    }
</style>

函数SetContextKey(){
$find(“”).set_contextKey($get(“”.value);
}
函数setCompanyMasterID(源、事件参数){
var strIFSC=eventargs.get_value();
警报(strIFSC);
var Name=document.getElementById(“”)值;
警报(名称);
}
函数onListPopulated(){
var completionList=$find(“”).get_completionList();
completionList.style.width='200px';
对于(i=0;i
我的GetCity方法在Search.aspx页面中,因为我是在网络中搜索后使用的

[System.Web.Script.Services.ScriptMethod()]
        [System.Web.Services.WebMethod]
        public static List<string> GetCity(string prefixText, int count, string contextKey)
        {
            GCIntegrationClient objGCIntegrationClient = new GCIntegrationClient();
            WcfGCIntegrationService.ServiceResult objServiceResult = new WcfGCIntegrationService.ServiceResult();
            objServiceResult = objGCIntegrationClient.GetIFSCCodeLOV_GetObjectData(contextKey, "", prefixText);

            System.Threading.Thread.Sleep(20000);

            List<string> CityNames = new List<string>();
            for (int i = 0; i < objServiceResult.UserData.IFSCCodeGrid.Length; i++)
            {
                CityNames.Add(AjaxControlToolkit.AutoCompleteExtender.
                  CreateAutoCompleteItem(objServiceResult.UserData.IFSCCodeGrid[i].BankName, objServiceResult.UserData.IFSCCodeGrid[i].BankName));
            }
            return CityNames;
        }
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
公共静态列表GetCity(字符串prefixText、int count、字符串contextKey)
{
GCIntegrationClient objGCIntegrationClient=新的GCIntegrationClient();
WcfGCIntegrationService.ServiceResult objServiceResult=新的WcfGCIntegrationService.ServiceResult();
objServiceResult=objGCIntegrationClient.GetIFSCCodeLOV_GetObjectData(contextKey,“,prefixText);
系统。线程。线程。睡眠(20000);
List CityNames=新列表();
for(int i=0;i
问题是,当我键入文本时,GetCity方法并没有被触发。。。。 但是当它在aspx页面上时,它会被解雇并且工作正常。。。
它在ascx页面中不起作用…我搜索了很多东西,但没有得到适当的答案…请帮助我。

//在代码末尾执行类似操作

public class GetCity
{

    public GetCity()
    {
    }
    public GetCity(string Name, string Value)
    {
        this.Name = Name;
        this.Value = Value;
    }
    public string Name { get; set; }
    public string Value { get; set; }


}