简体   繁体   中英

pass arguments from client side to server side

I have two comboboxes and would like pass selected value and text to the server method (RadComboBoxItemsRequestedEventArgs) when the first combobox selected index changed.

Here is my code. But I am getting Javascript error message at this line. RadComboBox2.requestItems(item, false) . Thanks for the help.

<telerik:RadComboBox 
        ID="RadComboBox1" 
        runat="server" 
        OnClientSelectedIndexChanging="LoadNames"
        OnItemsRequested="RadComboBox1_ItemsRequested" 
/>
<telerik:RadComboBox 
        ID="RadComboBox2" 
        runat="server" 
        AllowCustomText="true"                    
        OnItemsRequested="RadComboBox2_ItemsRequested" 
/>

.

    function LoadNames(combo, eventArqs)
    {
        var item = eventArqs.get_item();
        var RadComboBox2= $find('<%= RadComboBox2.ClientID %>');
        RadComboBox2.requestItems(item, false);
    }

    protected void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
          // I want first combobox text and value here
            LoadNames(e.Text, e.Value);
    }

item is supposed to be a string, not an object, try using item.get_text() or item.get_value()

on the server side you can get that string http://www.telerik.com/help/aspnet/combobox/combo_client_model.html

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