Monday, 6 February 2012

How to store a dataset in a viewstate?

Storing a DataSet inside of the ViewState is a bad practice. If the DataSet will hold hundred of records the ViewState will become very big and you'll get a panelty of performance in the browser page load.

You can save the data in the Session instead or reload it whenever neccesery.

Storing

viewstate["datasetname"] = ds;

For Retrieving

ds = (dataset) viewstate["datasetname"];

No comments:

Post a Comment