日期:2014-05-17  浏览次数:20439 次

多个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>");