asp.net中,服务器控件Repeater中有RadioButtonList,如何获得RadioButtonList的选中项的值?(类似试卷)

2024-12-01 09:58:01
推荐回答(3个)
回答1:

设置变量,将RadioButtonList选中的值赋给它,变量=this.RadioButtonList1.SelectedItem.Text.Trim()

回答2:

RadioButtonList rbtn=e.item.findcontrol("单选框的ID") as RadioButtonList
这样试试

回答3:

repeater进行循环判断
string val;foreach(RepeaterItem ri in Repeater1.Items)
{
RadioButtonList rb=ri.FindControl("RadioButtonList1") as RadioButtonList;
if(rb!=null)
{val=rb.SelectedValue;}
}