开发者

pass arguments from client side to server side

开发者 https://www.devze.com 2023-02-10 01:32 出处:网络
I have two comboboxes and would like pass selected value and text to the server method (RadComboBoxItemsRequestedEventArgs) when the first combobox selected index changed.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消