problem in the dataset

  • Thread starter Thread starter Raghu Raman
  • Start date Start date
R

Raghu Raman

Hi ,

i have a class and has a method which accepts a qry and results a
dataset.In my aspx page,i have a dataset .am filling this dataset by
calling that class in the pageload event.is working nice .

since the dataset is the object, holds disconnected data, i am trying
to get the data from that dataset in the buttons click() event . but
there is no data in teh dataset.

the problem is it just empty the dataset after any event .i need that
data set should hold the data for ever in that page.

could u pls tell me how to do that.

With thanks
a drop in the ocean
 
Two possible places to store the dataset are in the viewstate or in the
session. You wouldn't want to do this for a large dataset, but for a
small dataset (a hundred rows or so), it shouln't be a problem.

If you store it in the Viewstate, it's stored in hidden form fields
that are passed back and forth to the user. This saves server
resources, but you may significantly increase the HTML you're passing
back and forth to the client's browser, which could slow performance.
You could also store the information in the session, but you need to
keep in mind that storing large datasets for several users in session
can use up server memory pretty quickly.

This article has some information on storing a dataset in Viewstate:
http://www.developer.com/net/asp/article.php/2210191

The basic idea is that you load the data on page load and immediately
put it in the Viewstate. Then on subsequent postbacks, you check the
viewstate value to make sure it's not null and load the dataset from
it. If it's missing, you reload the data from the database.
- Jon
http://weblogs.asp.net/jgalloway
 
Back
Top