Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
InitializeDataSource
posted

I am using this event to initialize the data in a webgrid......using this code:

void WebGrid_InitializeDataSource(object sender, UltraGridEventArgs e)

{DataSet myDataSet = Search();

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

Parents
No Data
Reply
  • 28464
    posted

    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.

Children
No Data