我有两个组合框,当第一个组合框选定的索引发生更改时,我希望将选定的值和文本传递到服务器方法 (RadComboBoxItemsRequestedEventArgs)。
这是我的代码。但我在这一行收到 Javascript 错误消息。 RadComboBox2.requestItems(item, false)
。感谢您的帮助。
<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
应该是一个字符串,而不是一个对象,请尝试使用
item.get_text()
或 item.get_value()
在服务器端你可以得到字符串 http://www.telerik.com/help/aspnet/combobox/combo_client_model.html
关于javascript - 将参数从客户端传递到服务器端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4964870/