当前位置: 代码迷 >> ASP.NET >> 得到GridView中的单元格的值,该如何处理
  详细解决方案

得到GridView中的单元格的值,该如何处理

热度:8711   发布时间:2013-02-25 00:00:00.0
得到GridView中的单元格的值

用这样GridView1.Rows[e.RowIndex].Cells[0].Text我怎么取不到值啊??????请谁来帮帮我

------解决方案--------------------------------------------------------
1.你的Cells[0]是button,linkbutton?还是模板列?
2.你的Cells[0]本身就没值,这个时候取的是 
请贴上你的代码,谢谢。
------解决方案--------------------------------------------------------
模板列的话需要遍历Controls集合。
------解决方案--------------------------------------------------------
((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim()
------解决方案--------------------------------------------------------
GridView1.DataKeys[e.RowIndex].Value.ToString()
  相关解决方案