2011-07-03 43 views

回答

0

也許你可以嘗試下面的代碼來添加控件。
以下代碼將文本框添加到包含頁腳行的每一行中的第二個單元格。

protected void gvTest_RowDataBound(object sender, GridViewRowEventArgs e) 
    { 
     if (e.Row.RowType == DataControlRowType.DataRow) 
     { 
      TextBox tbox = new TextBox(); 
      tbox = "the text you wasnt to add or bind with data field"; 
      e.Row.Cells[1].Controls.Add(tbox); 
     } 

     if (e.Row.RowType == DataControlRowType.Footer) 
     { 
      TextBox tbox = new TextBox(); 
      tbox = "the text you wasnt to add or bind with data field"; 
      e.Row.Cells[1].Controls.Add(tbox); 
     } 
    } 
相關問題