I'm trying to access datasource before I bind it to grid. How do I do that? My guess I should look in one of the events like Grid.DataBinding
+1
A:
Yes, the GridView.DataBinding event will be raised prior to the control being bound. You can access the DataSource control in that event and make modifications if you so desire (for example, modifying parameters).
protected void Grid_DataBinding(object sender, EventArgs e)
{
mySqlDataSource.SelectCommand = "Select * from Stars";
}
Cerebrus
2009-04-29 14:52:19
A:
One way would be to not define the datasource on the grid itself. In the page_load, create and populate your datasource and then dynamically bind it to your datagrid. That way you would be able to access it.
Hope it helps!
FailBoy
2009-04-29 14:52:42