table.aspx

来自「本书通过100个精彩实例」· ASPX 代码 · 共 48 行

ASPX
48
字号
<html><head>
<script language="VB" runat="server">
    Sub Page_Load(Sender As Object , E As EventArgs)
        Dim i, j As integer
        Dim row As TableRow
        Dim cell As TableCell
        for i=1 to DropDownList1.SelectedItem.Text
            row=new TableRow()
            for j=1 to DropDownList2.SelectedItem.Text
               cell=new TableCell()
               cell.Text="第" & i & "行,第" & j & "列"
               row.Cells.Add(cell)
            Next
            T1.Rows.Add(row)
        Next
    end Sub
</script></head>
<body>
   <H3>使用Table控件<Hr></H3>
<form runat="server">
    <p><asp:Table id="T1" runat="Server"
    GridLines="Both"
    Cellpadding=5
    CellSpacing=2/>
    <p>
表格共:
<asp:DropDownList id="DropDownList1" runat="Server">
       <asp:ListItem Text="1"/>
       <asp:ListItem Text="2"/>
       <asp:ListItem Text="3"/>
       <asp:ListItem Text="4"/>
    </asp:DropDownList>
行,
<BR>
表格共:
<asp:DropDownList id="DropDownList2" runat="Server">
       <asp:ListItem Text="1"/>
       <asp:ListItem Text="2"/>
       <asp:ListItem Text="3"/>
       <asp:ListItem Text="4"/>
       <asp:ListItem Text="5"/>
    </asp:DropDownList>
列。
    <asp:Button Text="提交" runat="server"/>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?