我用row.Cells.Add();Table_company.Rows.Add()实现了动态添加table控件的行,请问如何动态删除table的行?请给我具体的代码,谢谢!(是c#,不是javascript)

解决方案 »

  1.   

    怎么使用?我用下面方法结果不行。TableRow row = new TableRow();
    row.ID = "tr_c2";
    Table.Rows.Remove(row);
      

  2.   


     TableRow tr1 = new TableRow();
            TableCell tc1 = new TableCell();
            tc1.Text = "one";
            tr1.Cells.Add(tc1);        TableRow tr2 = new TableRow();
            TableCell tc2 = new TableCell();
            tc2.Text = "two";
            tr2.Cells.Add(tc2);
    //增加
            this.Table1.Rows.Add(tr1);
            this.Table1.Rows.Add(tr2);        //删除        foreach (TableRow tr in this.Table1.Rows)
            {
                if (tr.Cells[0].Text == "one")
                {
                    this.Table1.Rows.Remove(tr);
                }
            }
      

  3.   

    多谢上面的兄弟们;请问:
    Table.Rows.Remove(row);里面的row如果不用循环的话,如何绑定到特定的行(id="tr_c2"),谢谢!
      

  4.   

    即 参数 row 如何赋值?