首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

多个RadioButtonList在结束时怎么查看那个未选

2013-07-16 
多个RadioButtonList在结束时如何查看那个未选如题~~恩有后台的给后台~~前台的麻烦说详细点~~- -[解决办法

多个RadioButtonList在结束时如何查看那个未选
如题~~恩有后台的给后台~~前台的麻烦说详细点~~- -
[解决办法]
代码都贴给你了,基础要加强啊,如果直接复制都搞不出来。。。
前台:
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True">
            <asp:ListItem>AAA</asp:ListItem>
            <asp:ListItem>BBB</asp:ListItem>
            <asp:ListItem>CCC</asp:ListItem>
        </asp:RadioButtonList>&nbsp;</div>
        <br />
        <asp:RadioButtonList ID="RadioButtonList2" runat="server" AutoPostBack="True">
            <asp:ListItem>1</asp:ListItem>
            <asp:ListItem>2</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
        </asp:RadioButtonList>
    </form>
</body>
后台:
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();
        foreach (Control cl in form1.Controls)
        {
            if (cl is RadioButtonList)
            {
                if (((RadioButtonList)cl).SelectedIndex == -1)
                {
                    Response.Write(cl.ID + "未选择<br>");


                }
            }
        }
    }

热点排行