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 5
            row=new TableRow()
            for j=1 to 5
               cell=new TableCell()
               cell.Controls.Add(New TextBox)
               textbox.Text="第" & i & "行,第" & j & "列"
               row.Cells.Add(cell)
            Next
            T1.Rows.Add(row)
        Next
    end Sub
</script>
cell.Controls.Add(New TextBox) 
怎么定义 New TextBox 的名称,id 什么的? 
比如 在---第" & i & "行,第" & j & "列 把其id 定义为 "&ij&"那里有cell.(...)这一系列属性的说明文章教程呢?

解决方案 »

  1.   

    Sub Page_Load(Sender As Object , E As EventArgs)
            Dim i, j As integer
            Dim row As TableRow
            Dim cell As TableCell
            Dim txtBox As TextBox
            for i=1 to 5
                row=new TableRow()
                for j=1 to 5
                   cell=new TableCell()
                   txtBox=new TextBox
                   txtBox.id="txtBox" &j
                   txtBox.Text="第" & i & "行,第" & j & "列"
                   cell.Controls.Add(txtBox)
                   row.Cells.Add(cell)
                Next
                T1.Rows.Add(row)
            Next
        end Sub
    </script>
      

  2.   

    cell.Controls.Add(New TextBox)-->     TextBox myTextBox=new TextBox;//
         myTextBox.ID="myTextBox"+i+j //
         cell.Controls.Add(New TextBox)