If you are trying to retrieve the data after postback, datasource will return null unless you bind the data again. If your GridView ViewState is not disabled, you can access the data by iterating rows and columns like this:
foreach(GridViewRow row in grdRawData.Rows)
{
myData = row.Cells[ColNum].Text; // For BoundField only.//
}
If you are using controls, say TextBox, in GridView Columns, you can fetch the data by using FindControl method.
TextBox txtName = (TextBox)grdRawData.Rows[rowNum].FindControl("IdOfTextBox"); // For BoundField only.//
myData = txtName.Text;
Hope this will help.
Anurag Gandhi.
http://www.gandhisoft.com
Life is a computer program and every one is the programmer of his own life.
My latest article: Group GridView Data