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

怎样从DataGrid中取出数据啊?
怎样从DataGrid中取出数据啊?把从DataGrid中取出的数据用文本框显示,不知该怎样取出?

------解决方案--------------------
dataGridView1.Rows[0].Cells[0].Value;

差不多就这样了
------解决方案--------------------
DataGrid 与 DataGridView有点不同,以下是分别对两种控件取数据方法:

1. DataGrid
textBox1.text = this.dgrd_SellTable[RowNumber,columnNumber].ToString();

2.DataGridView
textBox1.text = this.dataGridView1[columnNumber,RowNumber].Value.ToString();
textBox1.text = this.dataGridView1.Rows[0].Cells[1].Value.ToString();

------解决方案--------------------
如果单元格内无控件,用这种方式:
GridView1.Rows[0].Cells[0].Value;
如果单元格内有控件,用这种方式:
GridView1.Row[0].FindControl( "controlId ").Text;