重新排序服务器端的表行

时间:2011-02-22 13:20:16

标签: asp.net vb.net html-table

我有一张包含asp radiututtonlists(见下文)的调查表。提交后,结果将写入数据库。

我想使用同一张表进行类似的调查,但问题是问题顺序需要不同。问题是相同的,只是顺序不同。

是否有办法(服务器端)更改表格行的顺序?

        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>EXCELLENT</td>
              <td>GOOD</td>
              <td>AVERAGE</td>
              <td>POOR</td>
            </tr>
            <tr>
              <td>1</td>
              <td>Question 1</td>
              <td colspan="4" class="radiocell"><asp:RadioButtonList ID="question1" runat="server" CssClass="radiooptions" RepeatColumns="4" CellPadding="0" CellSpacing="0">
                <asp:ListItem id="answer1_1" runat="server" Value="1" Text="" />                
                <asp:ListItem id="answer1_2" runat="server" Value="2" Text="" />                
                <asp:ListItem id="answer1_3" runat="server" Value="3" Text="" />                
                <asp:ListItem id="answer1_4" runat="server" Value="4" Text="" />                
              </asp:RadioButtonList></td>
            </tr>
            <tr>
              <td>2</td>
              <td>Question 2</td>
              <td colspan="4" class="radiocell"><asp:RadioButtonList ID="question2" runat="server" CssClass="radiooptions" RepeatColumns="4" CellPadding="0" CellSpacing="0">
                <asp:ListItem id="answer2_1" runat="server" Value="1" Text="" />                
                <asp:ListItem id="answer2_2" runat="server" Value="2" Text="" />                
                <asp:ListItem id="answer2_3" runat="server" Value="3" Text="" />                
                <asp:ListItem id="answer2_4" runat="server" Value="4" Text="" />                
              </asp:RadioButtonList></td>
            </tr>
            <tr>
              <td>3</td>
              <td>Question 3</td>
              <td colspan="4" class="radiocell"><asp:RadioButtonList ID="question3" runat="server" CssClass="radiooptions" RepeatColumns="4" CellPadding="0" CellSpacing="0">
                <asp:ListItem id="answer3_1" runat="server" Value="1" Text="" />                
                <asp:ListItem id="answer3_2" runat="server" Value="2" Text="" />                
                <asp:ListItem id="answer3_3" runat="server" Value="3" Text="" />                
                <asp:ListItem id="answer3_4" runat="server" Value="4" Text="" />                
              </asp:RadioButtonList></td>
            </tr>
          </table>

1 个答案:

答案 0 :(得分:2)

您可以使用ASP.Net DataListRepeater来相应地对DataSource进行排序。