简体   繁体   English

如何从asp.net中的radcombobox传递Web服务中的多个参数?

[英]How to pass multi parameters in webservice from radcombobox in asp.net?

How to pass multiple parameters in webmethod from radcombobox? 如何通过radcombobox在webmethod中传递多个参数? I use a radocombobox that use webservice. 我使用使用webservice的radocombobox。 I want to pass 2 parameters to webmethod. 我想将2个参数传递给webmethod。 How do I do it? 我该怎么做?

 <telerik:RadComboBox ID="radCmbAccountList" runat="server" 
    CssClass="radCtrlCombo h4"  EnableLoadOnDemand="true"
    EnableVirtualScrolling="true" LoadingMessage="در حال دریافت اطلاعات.." 
    Width="128px" MinFilterLength="1" Skin="WebBlue">
    <WebServiceSettings Method="GetAccountList" Path="~/Services/WebService.asmx" > 
    </WebServiceSettings>
  </telerik:RadComboBox>
 [WebMethod]
public RadComboBoxData GetAccountList(RadComboBoxContext context, int accountID)
{}

I Want to pass accountID to webMethod. 我想将accountID传递给webMethod。

The RadComboBoxContext object is a dictionary. RadComboBoxContext对象是一个字典。 You only need to pass in the single parameter context , then in the web method you can access its key/value pairs. 您只需要传递单个参数context ,然后在web方法中就可以访问其键/值对。

Set the keys client-side to whatever you need: 将客户端密钥设置为所需的任何值:

<script type="text/javascript">
    function OnClientItemsRequesting(sender, eventArgs) {
        var context = eventArgs.get_context();

        context["accountID"] = 7;
        context["whatever"] = "Test";
    }
</script>

<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" 
EnableLoadOnDemand="true" OnClientItemsRequesting="OnClientItemsRequesting">  
    <WebServiceSettings Method="GetAccountList" Path="~/Services/WebService.asmx" />
</telerik:radcombobox>

Then access the dictionary in the web method like you would any dictionary. 然后像访问任何词典一样,通过web方法访问该词典。

Take a look at this page and this demo for more information. 查看此页面此演示以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM