How to preserve dataset?

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

VB Programmer

I have a dataset that I'm using as a lookup table in my ASP.NET webform
(using VB.NET).

In the class I've defined it as "Public dsMyDs as DataSet".

In the Page_Load, if Not Page.IsPostBack, then it first sets "dsMyDs = New
DataSet" then populates it.

I have a dropdownlist that has AutoPostBack set to true. When I select an
item I want to "look up" the description for that item, using a table in my
dataset. But, by the time I re-enter the page the dataset seems to be gone.

How do I preserve the dataset for later reference/use?

Thanks.
 
How about saving the dataset to the cache? to save
Use Cache.Insert to save the dataset.May be at a later point you can remove
the dataset from cache.

Biswajit
 
Hi,

VB Programmer said:
Do I have to save the dataset to a session variable to use it later?

Yup. If you store it at page level (as you've described before) the data
goes when page is recreated.
 
Back
Top