[英]How to use Radio Button in Repeater to retrieve data from sql?
如您所知,您的 RadioButtns 在中继器中,因此您必须使用Foreach
循环将这些按钮文本从中继器设置为:
foreach (RepeaterItem item in Repeater1.Items)
{
// Check for data item or alternating item
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
// find your radiobutton from repeater's item
RadioButton RadioButton1 = item.FindControl("RadioButton1") as RadioButton;
RadioButton1.Text = dr.GetString(5);
//.. some other code
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.