ASP .NET GridView Access to Data In Code
There are situations where you want to gain access to the GridView’s DataSet to display extra information outside of the GridView. I found the following code to work the best for me. You can get the information from the DataSource of a GridView by doing the following:
DataView dv = (DataView)sdsDataSource.Select(DataSourceSelectArguments.Empty); if (dv != null) { try { strName = (String)dv.Table.Rows[0][“Name”]; } catch { strName = “N/A”; } }
You should be able to access whatever information you need from the DataView.