日期:2014-05-18  浏览次数:20366 次

得到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()