添加包含下拉框C#的新行

时间:2015-08-13 10:13:30

标签: c# asp.net

我在一行中有三个下拉列表,还有一个按钮      在末尾。我想要实现的是OnClick的“添加”按钮,应该在前一行下创建一个新行,以及另一个“添加”按钮。

我希望这个过程最多重复30次,即将有29个“添加”按钮。

非常感谢您的回复。

 default.aspx
<asp:Table ID="TblUni" runat="server" Width="600" Height="60">
                            <asp:TableRow>
                                <asp:TableCell><asp:Label ID="LblUni" runat="server" Text="University"></asp:Label></asp:TableCell>
                                <asp:TableCell><asp:Label ID="LblSchool" runat="server" Text="School"></asp:Label></asp:TableCell>
                                <asp:TableCell><asp:Label ID="LblDepartment" runat="server" Text="Type"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                            <asp:TableCell>
                                <asp:DropDownList ID="drpUniversity" runat="server" Width="200" AutoPostBack="true"  OnSelectedIndexChanged="drpUni_SelectedIndexChanged"></asp:DropDownList>                    
                            </asp:TableCell>
                            <asp:TableCell>
                                <asp:DropDownList ID="drpSchool" runat="server" Width="200" AutoPostBack ="true" OnSelectedIndexChanged="drpSchool_SelectedIndexChanged"></asp:DropDownList>
                            </asp:TableCell>
                            <asp:TableCell>
                                <asp:DropDownList ID="drpDept" runat="server" Width="200" AutoPostBack="true"></asp:DropDownList>
                            </asp:TableCell>
                            <asp:TableCell>
                                <asp:Button ID="addUSD" Text="+" runat="server" OnClick="addUSD_Click" />                                    
                            </asp:TableCell>                             </asp:TableRow>                                                                 
                        </asp:Table>
      default.aspx.cs
      protected void addUSD(object sender, EventArgs e)
      {//empty event
      }

1 个答案:

答案 0 :(得分:0)

您可以尝试使用三列类型下拉组合框构建datagridview,它会自动添加行

相关问题