2013-01-06 76 views
0

您好,我正在開發一個asp.net項目。asp.net row_created獲取第一行插入單元格的文本

我正在使用數據庫和gridview。 我想要創建每個gridviewrow的第一個單元格的名稱。 爲什麼這不起作用?

protected void CustomersGridView_RowCreated(Object sender, GridViewRowEventArgs e) 
     { 
      if (e.Row.RowType == DataControlRowType.DataRow) 
      { 
       Response.Write(e.Row.Cells[0].Text); 
      } 
} 

回答

0

如果你想獲得一個GridView的每一行的第一列的文本,然後使用代碼如下: -

保護無效GridView1_RowDataBound(對象發件人,GridViewRowEventArgs E) {

Response.Write(e.Row.Cells[0].Text); 
} 
相關問題