How can I set the value of my rad combobox if I keep getting this error message, even if the combobox has the ReadOnly="false" attribute set in the markup?
protected void Page_Init(object sender, EventArgs e)
{
string dateArg = Request.QueryString["date"];
if (dateArg != null)
{
rcbWeek.SelectedItem = rcbWeek.FindItemByText(dateArg);
}
}
Here is how to do it, you can find it in the docs for the Rad Controls:
http://www.telerik.com/help/aspnet-ajax/combobox-items-server-side-code.html
//Use RadComboBoxItem.Selected
RadComboBoxItem item = RadComboBox1.FindItemByText("Item 2");
item.Selected = true;
//Use RadComboBox.SelectedIndex
int index = RadComboBox1.FindItemIndexByValue("2");
RadComboBox1.SelectedIndex = index;
//You can also use the SelectedValue property.
RadComboBox1.SelectedValue = value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With