I am using this event to initialize the data in a webgrid......using this code:
void WebGrid_InitializeDataSource(object sender, UltraGridEventArgs e)
DataTable myTable = myDataSet.Tables[1];
WebGrid.DataSource = myTable;
}
But at the first page load I do not want to show the data, the grid should be empty...
How can I do it?
Thanks
but at the first load
Or alternatively, you can bind to an empty datatabase (e.g. the DataSet you are binding to can be empty). But then again, it really depends on your scenario - e.g. the first time the page will be loaded Page.IsPostBack will be false, but will all subsequent hits to the page be postback actions or not? If they are going to be postback, it is relatively easy, you can just check Page.IsPostBack prior to binding (in InitializeDataSource as well). If not, then maybe you can store a flag in Session or ViewState to check if this is the first time or not.
You can fill grid on button click. Or can place condition to fill grid in page load.