读书人

跪求解决5555555555

发布时间: 2012-08-28 12:37:01 作者: rapoo

跪求大虾解决5555555555

HTML code
<body>    <form id="form1" runat="server">        <div style="text-align:left">            <table>                <%                    System.Collections.Generic.IList<Topic> list = GetAllTopic();                    for (int i = 0; i < list.Count; i++)                    {                        Topic topic = list[i];                        Label1.Text = topic.题号 + "," + topic.内容;                    %>                <tr>                    <td colspan="2"><asp:Label ID="Label1" runat="server"></asp:Label></td>                </tr>                    <%                        switch (topic.类型)                        {                            case "单选":                                for (int j = 0; j < topic.选项.Count; j++)                                {                                    RadioButton1.Text = topic.选项[j].选项 + "," + topic.选项[j].内容;                                %>                <tr>                    <asp:Panel ID="Panel1" runat="server">                    <td style="width:20px"></td>                    <td><asp:RadioButton ID="RadioButton1" runat="server"></asp:RadioButton></td>                    </asp:Panel>                </tr>                                <%                                }                                     break;                            case "多选":                                for (int j = 0; j < topic.选项.Count; j++)                                {                                    CheckBox1.Text = topic.选项[j].选项 + "," + topic.选项[j].内容;                                 %>                <tr>                    <td style="width:20px"></td>                    <td><asp:CheckBox ID="CheckBox1" runat="server" /></td>                </tr>                                <%                                }                                break;                            default:                                %>                <tr>                    <td style="width:20px"></td>                    <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>                </tr>                                <%                                break;                        }                    }                     %>            </table>        </div>            </form></body>

C# code
    /// <summary>    /// 获取题的集合    /// </summary>    /// <returns>题目集合</returns>    protected IList<Topic> GetAllTopic()     {        IList<Topic> list = new List<Topic>();        SqlDataReader dr1 = DBHelper.ExecuteQuery("select 题号,类型,内容 from 题目 order by 题号");        while (dr1.Read())        {            Topic topic = new Topic();            topic.内容 = dr1["内容"].ToString();            topic.类型 = dr1["类型"].ToString();            topic.题号 = int.Parse(dr1["题号"].ToString());            IList<Option> options = new List<Option>();            SqlDataReader dr2 = DBHelper.ExecuteQuery("select 题号,选项,内容 from 选项 where 题号 = " + topic.题号);            while (dr2.Read())            {                Option option = new Option();                option.内容 = dr2["内容"].ToString();                option.选项 = dr2["选项"].ToString();                option.题号 = int.Parse(dr2["题号"].ToString());                options.Add(option);            }            topic.选项 = options;            list.Add(topic);        }        return list;    } 



全部代码如上,请问怎么才能让每一个提的单选按钮互斥并且和其他题目的答案不互斥
顺便问一下,这样的前台代码我在提交的时候我如何在后台获取数据呢?
如果可行,请出关键代码,后台如何获取数据
如果不可行,请给出解决方案,最好有代码示例
小弟在这里感激不尽,谢谢

[解决办法]
前台获取后台数据----ajax
拼字符串
radio互相排斥的,可以用相同的name属性
比如
<input type='radio' name='s1'>s001
<input type='radio' name='s1'>s002
<input type='radio' name='s1'>s003
<input type='radio' name='s1'>s004
[解决办法]
探讨

前台获取后台数据----ajax
拼字符串
radio互相排斥的,可以用相同的name属性
比如
<input type='radio' name='s1'>s001
<input type='radio' name='s1'>s002
<input type='radio' name='s1'>s003
<input type='radio' name='s1'>s004

[解决办法]
探讨
前台获取后台数据----ajax
拼字符串
radio互相排斥的,可以用相同的name属性
比如
<input type='radio' name='s1'>s001
<input type='radio' name='s1'>s002
<input type='radio' name='s1'>s003
<input type='radio' name='s1'>s004

读书人网 >asp.net

热点推荐