这是数据绑定代码:
protected void Page_Init(object sender, EventArgs e)
{
List<ListItem> source = new List<ListItem>();
source.Add(new ListItem("Remark A", "0"));
source.Add(new ListItem("Remark B", "1"));
source.Add(new ListItem("Remark C", "2"));
rbnRemarks.DataSource = source;
rbnRemarks.DataBind();
}
protected void rbnRemarks_SelectedIndexChanged(object sender, EventArgs e)
{
refreshGrid();
}
这是标记页面:
<asp:RadioButtonList OnSelectedIndexChanged="rbnRemarks_SelectedIndexChanged" AutoPostBack="true" runat="server" ID="rbnRemarks" RepeatDirection="Horizontal">
</asp:RadioButtonList>
问题是:
如果我将所选项目更改为备注B或备注C,则会触发事件,但如果我将所选项目更改回备注A,则不会触发事件并且仅当我选择备注B或备注时才会触发Page_Init C,为什么会发生这种情况?