Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataset all gone

Status
Not open for further replies.

marcusmco

IS-IT--Management
Oct 9, 2006
30
0
0
AU
I have used datasets in vb.net applications and now I am trying to do the same in asp.net. :)

On a web page I create a dataset and populate a few text boxes. When the user clicks a button and the page is posted back the dataset does not exist anymore (yes, I am new to asp.net). Is it correct that I have to create the dataset again when the page is posted back...?
 
You have to repopulate the dataset each time the page loads.
 
Thanks. I was afraid that was the case. :)
 
>>You have to repopulate the dataset each time the page loads.

or use Sessions, ViewState, Caching etc to maintain "state". but the concept is the same, once the page is rendered to the user ALL objects in that page expire...

Known is handfull, Unknown is worldfull
 
I think that you may be wanting something like this.

In the page_load event I'm assuming that you're filling your drop down lists with values from a dataset. But, you don't need to do this again on postback simply to maintain the items in your list. Just put your binding method inside the following:

If Not Page.IsPostback Then
'Your binding method
End If

These values will be saved in the viewstate and will stay in your list. It is true that the dataset itself won't exist, but that is a different situation. If you actually need the entire dataset then do what was mentioned above and go for caching.

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top