Paging and cache

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

When a GridView gets information back from the server and it is doing paging
(or anytime I suppose).

Where is it putting the data while it renders the data.

If I do a DataBind or use an SQLDataSource and the data comes back (say
10,000 rows) and you are having the GridView handle the paging. Where does
it put the data in the interim?

Does it cache it on the Client side somewhere?

Thanks,

Tom
 
tshad said:
When a GridView gets information back from the server and it is doing paging
(or anytime I suppose).

Where is it putting the data while it renders the data.

If I do a DataBind or use an SQLDataSource and the data comes back (say
10,000 rows) and you are having the GridView handle the paging. Where does
it put the data in the interim?

Does it cache it on the Client side somewhere?

It goes back to the database each time you page I suspect when using a
datasource.
 
Mr. Arnold said:
It goes back to the database each time you page I suspect when using a
datasource.

Right.

But when you do a DataBind - The database would send you back all the data
you request at once (unless you are using a Reader) and it would have to be
stored in some structure while the object is working with it (extracting a
page for instance) or before the rendering of the page.

I am just curious as to where asp puts it - in some dataset somewhere?

For example, I could do an stored procedure call from a GridView.DataBind()
and 10,000 rows could come back but I only want page 5. The GridView would
have to store the 10,000 rows somewhere and determine which rows to put on
the page. Could be in a DataSet somewhere and when the page is rendered it
would go through the dataset to get the data it needs.

Where would the DataSet be? Since the DataBind() would be done on the
server, where would the Server put it before it rendered the page.

Thanks,

Tom
 
tshad said:
Right.

But when you do a DataBind - The database would send you back all the data
you request at once (unless you are using a Reader) and it would have to be
stored in some structure while the object is working with it (extracting a
page for instance) or before the rendering of the page.

I am just curious as to where asp puts it - in some dataset somewhere?

For example, I could do an stored procedure call from a GridView.DataBind()
and 10,000 rows could come back but I only want page 5. The GridView would
have to store the 10,000 rows somewhere and determine which rows to put on
the page. Could be in a DataSet somewhere and when the page is rendered it
would go through the dataset to get the data it needs.

Where would the DataSet be? Since the DataBind() would be done on the
server, where would the Server put it before it rendered the page.

It goes back each time one pages and reads those 10,000 records every
time. As far as what page to page too and how many lines per page, that
has already been predetermined.

That dataset is only good for the life of the page, and if one wanted to
save the dataset and bind to the dataset and not go back to the
database, then on puts the dataset in a session variable and save it,
binding the dataset held in session to the control.
 
Mr. Arnold said:
It goes back each time one pages and reads those 10,000 records every
time. As far as what page to page too and how many lines per page, that
has already been predetermined.

That dataset is only good for the life of the page, and if one wanted to
save the dataset and bind to the dataset and not go back to the database,
then on puts the dataset in a session variable and save it, binding the
dataset held in session to the control.

I understand that.

I think you misunderstand what I am asking. This question came up at work
today.

I am trying to figure out where the data is stored while it is rendering the
page. The data has to be somewhere after the result set is returned until
the data is rendered to the screen.

Where is it?

Thanks,

Tom
 
tshad said:
I understand that.

I think you misunderstand what I am asking. This question came up at work
today.

I am trying to figure out where the data is stored while it is rendering the
page. The data has to be somewhere after the result set is returned until
the data is rendered to the screen.

The data for a given page is saved in view state, if view state for the
control has been enabled. The data is in the dataset for the life of the
page.
 
I am trying to figure out where the data is stored while it is rendering
the page. The data has to be somewhere after the result set is returned
until the data is rendered to the screen.

Where is it?

Thanks,

Tom
It's in whatever is your datasource.

It is most definitely NOT sent to the client.
With default paging, the gridview takes whichever subset it wants out of the
datasource.
So you could read data into a collection and cache it before handing it to
your datasource, which in turn is used by the gridview.
 
Back
Top