C# RadioButtonList验证索引

C# RadioButtonList验证索引,c#,asp.net,C#,Asp.net,我有一个Radiobuttonlist,我想在选择值为1的项目后做一些事情。当我使用RadioButtonListType.SelectedValue时返回,当我使用RadioButtonListType.SelectedIndex时返回-1。 我哪里做错了 这是我的密码 aspx 您的ID=RadioButtonListType和RadioButtonListSF不匹配。SelectedIndex噢,我没有看到。非常感谢。 <asp:RadioButtonList ID="RadioB

我有一个Radiobuttonlist,我想在选择值为1的项目后做一些事情。当我使用RadioButtonListType.SelectedValue时返回,当我使用RadioButtonListType.SelectedIndex时返回-1。 我哪里做错了

这是我的密码

aspx


您的ID=RadioButtonListType和RadioButtonListSF不匹配。SelectedIndex噢,我没有看到。非常感谢。
 <asp:RadioButtonList ID="RadioButtonListType" runat="server" OnSelectedIndexChanged="RadioButtonListType_SelectedIndexChanged" ValidationGroup="emergency" AutoPostBack="True">
                                <asp:ListItem Value="0">Normal</asp:ListItem>
                                <asp:ListItem Value="1">Emergency</asp:ListItem>
                            </asp:RadioButtonList>
protected void RadioButtonListType_SelectedIndexChanged(object sender, EventArgs e)
{
    if (RadioButtonListSF.SelectedIndex == 1)
    {
        MPEEmergency.Show();
    }
}