Dataset not persisted on PostBack

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

I have a dataset which I fill in the Page_Load (only 'If Not
Page.IsPostBack'). When I debug the load:
dsmyds1.Tables(0).Rows.Count = 207

When I click on a button and it posts back the dataset and I debug:
dsmyds1.Tables(0).Rows.Count = 0

Any ideas why? The dataset is on the designer.

Thanks.
 
You would only want to use a session variable if you need the dataset between different pages. If you only require the information retained for the current page, you should use the ViewState object to store your dataset as it will only las as long as the page last.
 
Back
Top