need javascript to set an selected index for RADcombobox to 0
need javascr开发者_如何学运维ipt to set an selected index for RAD combobox to 0
Have you tried "ClearSelections"?
var combo = $find("<%= RadComboBox1.ClientID %>");
combo.clearSelection();
EDIT
Give this a shot:
var combo = $find("<%= RadComboBox1.ClientID %>");
var comboItem = new Telerik.Web.UI.RadComboBoxItem();
combo.trackChanges();
combo.get_items().getItem(0).select();
combo.commitChanges();
You should be able to do:
var combo = $find("<%= RadComboBox1.ClientID %>");
combo.get_items().get_item(0).select();
I believe you use get_item() to get the specific item. There is a selected index, but I've seen the preference being to use the select method instead on telerik forums.
EDIT: The RadComboBox uses the text property to reference the text in the combo, since the text isn't required to be an item in the list. You should test, because it's probably a selected index of -1. So, you can check and see if the selected index is a -1 or other value (not 100% sure if it's -1 or null on the client-side) and then programmably perform the selection. So is that the right response though, because I think the control then may wipe out your text...
精彩评论