设置单选按钮列表项的选择取决于数据库中的值 [英] Setting radiobuttonlist item selected depending on value in database
本文介绍了设置单选按钮列表项的选择取决于数据库中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的项目中搜索名称时,我想从数据库中获取有关该名称的所有数据.如果选中一个复选框,它将显示已选择的相应单选按钮列表项,该项目已保存在数据库中.
In my project while searching a name, I wants to get all datas about it from the database. If a checkbox is checked it should display the corresponding radiobuttonlist item as selected which is already saved in database. how can i set it as?
推荐答案
您可以从数据库中获取数据.对于每个单选按钮,您可以创建一个列表项:
You can fetch the data from the database. For each radio button, you can create a listitem:
ListItem item = new ListItem();
然后,您可以将此列表与ListItems绑定到单选按钮列表,并将一个列表项的selected属性设置为true:
You can then bind this list with ListItems to a radiobuttonlist and set the selected property of one listitem that is selected to true:
item.Selected = true;
这篇关于设置单选按钮列表项的选择取决于数据库中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文