Click to See Complete Forum and Search --> : Datagrid


Nagul
April 16th, 2003, 05:53 AM
Hi All,
I don't know whether it's a problem or it is like this only but i feel it as annoying.
I have a datagrid and i have written the below code in page_load event of the webform.

if not page.ispostback then
datagrid1.datasource = datatable.defaultview
datagrid1.databind()
endif

Now the problem is when the page again posted back on some event, i loose the data in the datagrid. Therefore i have to remove the if not page.postback condition and everytime a page is loaded it calls.

Anyone has any idea like what i am doing is correct or what should i be doing ????

Thanks...

V. Lorenzo
April 25th, 2003, 11:25 AM
I gues this behaviour should be the normal behaviour. Maybe I'm wrong but, think of this...

If the DataGrid, in order to "remember" the values of it's rows, has to store all of it's content in the ViewState...Would't that viewstate be huge? Maybe it should be better to store the values in the session or somre other place but the viewstate.

VLorz