简体   繁体   中英

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

How to pass multiple parameters in webmethod from radcombobox? I use a radocombobox that use webservice. I want to pass 2 parameters to 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.

The RadComboBoxContext object is a dictionary. You only need to pass in the single parameter context , then in the web method you can access its key/value pairs.

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.

Take a look at this page and this demo for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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