AJAX C# AutoCompleteExtender contextKey

余生颓废 提交于 2019-12-18 09:29:23

问题


How do you dynamically pass parameter/control to contextKey?

<asp:TextBox ID="tbA" runat="server" autocomplete="off"></asp:TextBox> 
<asp:TextBox ID="tbB" runat="server">hello</asp:TextBox> 
<asp:TextBox ID="tbC" runat="server">world</asp:TextBox>

<cc1:AutoCompleteExtender ID="aceListA" ServiceMethod="myListServiceA" ServicePath="WebService.asmx" TargetControlID="tbA" runat="server" EnableCaching="true" UseContextKey="true"> </cc1:AutoCompleteExtender>

  [WebMethod]
   public string[] myListServiceA(string prefixText, int count, string contextKey)

Because I want to check tbB, tbC at Web Service level. I've read this article like 5 times, but still doesn't make a sense out of it, per half missing complete codes.


回答1:


You can set the context key in two ways:

Client-Side, through Javascript:

<script type="text/javascript">
    function SetContextKey()
    {
        $find('auJobs').set_contextKey('moo');
        return;
    }

</script>  `

or on the server side auJobs.ContextKey = "Whatever You need to put in here"

Terry



来源:https://stackoverflow.com/questions/1440552/ajax-c-sharp-autocompleteextender-contextkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!