Pass arguments from the client side to the server

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

Here is my code. But I get a Javascript error on 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);
    }
+3
source share
1 answer

itemshould be a string, not an object, try using   item.get_text()  oritem.get_value()

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

0
source

Source: https://habr.com/ru/post/1791382/


All Articles