c# - 如何检查 radComboboxItem 'CheckBox' ?

标签 c# checkbox telerik radcombobox

我对库“Telerik”有一点疑问。 事实上,我想用'checkBox'实现'RadCombobox'。它运作良好,但当我想要 '检查'一个项目,这不可能?! 这是我的示例代码。我更改了属性“selected”的属性,但不幸的是,它没有选中“checked”框......

非常感谢您的回答!

<!-- 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;

最佳答案

首先尝试调用方法DataBind

RadComboBoxSelectedEntity.DataBind();

在调用 DataBind 之后,您可以尝试这行代码仍然无法正常工作,

RadComboBoxSelectedEntity.Items[1].Checked = true;

关于c# - 如何检查 radComboboxItem 'CheckBox' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11156142/

相关文章:

html - HTML复选框可以设置为只读吗?

c# - RadComboBox 在顶部添加一个项目

通过泛型实现的 C# 参数化属性类?

c# - 这是一个错误吗?浮点运算被视为整数

Javascript 待办事项列表

html - CSS 与复选框列表对齐 (runat=Server)

asp.net - 需要 RadcomboBox css 帮助

javascript - Cordova Telerik Native 转换插件

c# - HttpWebRequest 端口耗尽

c# - 使用反射获取元组的值