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);
}
}
}
}
------解决方案--------------------应该在ItemDataBound事件中处理
if (e.Item.ItemType==ListItemType.Item
------解决方案--------------------e.Item.ItemType==ListItemType.AlternatingItem)
{