我在我的 asp.net 表单中使用了一个 htmltable,但我想要在运行时使用多个 htmltable,比如当我点击提交它在我的 htmldatattable 中选择的相关数据时
我想在运行时生成的特定 htmltable 中查看特定的 id 记录,我该怎么做?
这是我的htmltable代码
protected void Page_Load(object sender, EventArgs e)
{
HtmlTable dTable = new HtmlTable();
dTable.CellPadding = 2;
// dTable.CellSpacing = 0;
dTable.Border = 1;
dTable.BorderColor = "#cccccc";
int tRows;
int tCells;
for (tRows = 0; tRows < 1; tRows++)
{
HtmlTableRow dTRow = new HtmlTableRow();
HtmlTableRow dtrow = new HtmlTableRow();
HtmlTableRow dtrow3 = new HtmlTableRow();
HtmlTableRow dtrow4 = new HtmlTableRow();
for (tCells = 0; tCells < 1; tCells++)
{
HtmlTableCell dTCell = new HtmlTableCell();
HtmlTableCell dtcell1 = new HtmlTableCell();
HtmlTableCell dtcell3 = new HtmlTableCell();
HtmlTableCell dtcell4 = new HtmlTableCell();
HtmlInputText txt = new HtmlInputText();
HtmlInputText txt1 = new HtmlInputText();
HtmlInputText txtAge = new HtmlInputText();
HtmlInputText txtHeight = new HtmlInputText();
dTCell.InnerText = "FirstName:: " + Convert.ToString(tRows);
dtcell1.InnerText = "LastName::" + Convert.ToString(tRows);
dtcell3.InnerText = "Age::" + Convert.ToInt32(tRows);
dtcell4.InnerText = "Height::" + Convert.ToString(tRows);
dTCell.Controls.Add(txt);
dtcell1.Controls.Add(txt1);
dtcell3.Controls.Add(txtAge);
dtcell4.Controls.Add(txtHeight);
dtrow.Controls.Add(dtcell1);
dtrow3.Controls.Add(dtcell3);
dtrow4.Controls.Add(dtcell4);
dTRow.Controls.Add(dTCell);
}
dTable.Controls.Add(dTRow);
dTable.Controls.Add(dtrow);
dTable.Controls.Add(dtrow3);
dTable.Controls.Add(dtrow4);
Panel1.Controls.Add(dTable);
}