repeater 中radiobuttonlist控件的SelectedIndexChanged事件怎么写
请问repeater 中radiobuttonlist控件的SelectedIndexChanged事件怎么写?小弟新人
[解决办法]
前台
<asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" >
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"手写的。
后台
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (RepeaterItem item in Repeater1.Items)
{
RadioButtonList RadioButtonList1 = item.FindControl("RadioButtonList1") as RadioButtonList;
foreach (ListItem l in RadioButtonList1.Items)
{
if (l.Selected == true)
{
Response.Write(l.Text + "<br>" + l.Value);
}
}
}
}
RadioButtonList rbl1 = (RadioButtonList)e.Item.FindControl("rbl");
//执行操作数据 rbl1.Items[0].Selected=true;
}