我对图书馆! Telerik'有一点问题。 事实上,我想实现一个' RadCombobox"' checkBox'。它运作良好,但我想要的时候 '检查'一个项目,这是不可能的?! 这是我的示例代码。我更改了属性' selected'但是这并没有勾选方框'检查'不幸的是.....
非常感谢您的回答!
<!-- language: lang-cs -->
//Define the sqlAdaptater for binding source
System.Data.SqlClient.SqlDataAdapter myBinding = new SqlDataAdapter("SELECT [name] FROM [dbo].[tblProcess] WHERE [currentVersion] = 1 AND [deleted] = 0 AND [parent] = 0",connectionString);
DataTable links = new DataTable();
myBinding.Fill(links);
//Set the attributs of RadCombobBox
RadComboBoxSelectedEntity.DataTextField = "name";
RadComboBoxSelectedEntity.DataValueField = "name";
RadComboBoxSelectedEntity.DataSource = links;
//Not working..its selected but not checked ?
RadComboBoxSelectedEntity.SelectedIndex = 1;
//Not exist ?? ->
RadComboBoxSelectedEntity.CheckedIndex = 1;
答案 0 :(得分:4)
首先尝试调用方法DataBind
RadComboBoxSelectedEntity.DataBind();
致电DataBind
后,您可以尝试使用此代码行,但
RadComboBoxSelectedEntity.Items[1].Checked = true;