我正在使用C#來發展我的技能。我正在嘗試一個我在網上找到的教程:http://geekswithblogs.net/dotNETvinz/archive/2009/03/17/dynamically-adding-textbox-control-to-aspnet-table.aspx,但是當我嘗試代碼並添加生成表方法時,它告訴我無法找到Table table = new Table();
的類型或名稱空間名稱。有人知道我應該使用哪個命名空間爲了這。這是代碼的其餘部分:創建動態表
private void GenerateTable(int colsCount, int rowsCount)
{
//Creat the Table and Add it to the Page
Table table = new Table();
table.ID = "Table1";
Page.Form.Controls.Add(table);
// Now iterate through the table and add your controls
for (int i = 0; i < rowsCount; i++)
{
TableRow row = new TableRow();
for (int j = 0; j < colsCount; j++)
{
TableCell cell = new TableCell();
TextBox tb = new TextBox();
// Set a unique ID for each TextBox added
tb.ID = "TextBoxRow_" + i + "Col_" + j;
// Add the control to the TableCell
cell.Controls.Add(tb);
// Add the TableCell to the TableRow
row.Cells.Add(cell);
}
// Add the TableRow to the Table
table.Rows.Add(row);
}
}
任何幫助,將不勝感激感謝