ASP.NET中服务器控件RadioButtonList 值改变为什么不触发SelectedIndexChanged

其他控件,如TextBox,DropDownList改变后都可以触发对应的changed事件,而且AutoPostBack = true设置了,但是RadioButtonList 我做的是男女性别选择,改变性别值后,还是不触发,怎么回事,谢谢。

以下是我的测试,没问题啊,我建议你重新建立一个新的ASPX页面测试下,看看有没有问题,如果运行正常那说明你那个页面的设置有问题,仔细检查一下。特别是前台事件绑定的方法名称和后台的方法名称是否一样。
前台:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
ForeColor="#FF3300"
onselectedindexchanged="RadioButtonList1_SelectedIndexChanged"
RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Value="man">man</asp:ListItem>
<asp:ListItem Value="woman">woman</asp:ListItem>
</asp:RadioButtonList>
后台:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
string str = RadioButtonList1.SelectedValue;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-04-19
你页面的标头能发我看下嘛
第2个回答  2012-04-19
贴代码
第3个回答  2012-04-19
设置组了么?追问

是RadioButtonList ,不是RadioButton,没有设置组的属性啊,本来就是一组

追答

喔,我比较菜,不太懂