Dataset not persisted on PostBack

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top