编辑
Table table = new Table();
TableRow tableRow = new TableRow();
TableCell tableCell = new TableCell();
tableCell.Text = "id";
tableRow.Cells.Add(tableCell);
tableCell = new TableCell();
tableCell.Text = "name";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
// ------------
tableRow = new TableRow();
tableCell = new TableCell();
tableCell.Text = "1";
tableRow.Cells.Add(tableCell);
tableCell = new TableCell();
tableCell.Text = "a";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
tableRow = new TableRow();
tableRow = new TableRow();
tableCell = new TableCell();
tableCell.Text = "2";
tableRow.Cells.Add(tableCell);
tableCell = new TableCell();
tableCell.Text = "b";
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
tableRow = new TableRow();
如何将客户端功能添加到第一行?
我想当用户单击第一行(名称或ID)
slideToggle
另一行时。该表在运行时创建。
最佳答案
您为此行指定一个ID,例如id =“ row1”,
我不确定如何在ASP中为表格和行提供ID,
$("#row1").live("click", function(){
$(this).slideToggle();
});