Datagrid viewstate contents?

G

Guest

Hi,

When binding a dataset to a DataGrid and paging 10 records at a time, is the
entire dataset still encoded and sent to viewstate as well OR just the
current page and what's visible to the user stored in the viewstate on the
browser?

I've added some excerpts from some articles so I'm not sure. Any other MS
links verifying this would be great.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp11222001.asp

"The DataGrid control is a particularly heavy user of ViewState. By default,
all of the data displayed in the grid is also stored in ViewState"

http://www.extremeexperts.com/Net/Articles/ViewState.aspx

"If you have Set EnableViewState to true for a DataGrid which is having
thousands of records. Then you will end up having viewstate size more than 10
KBytes."

The last article didn't say if the datagrid was using paging or not...
 
D

Dan Bass

This is what I found when first looking at Paging with large datasources,
and invite any MVP (or anyone else) to disagree completely, but...

The Datagrid holds whatever datasource it is bounded too... If you're using
SQL to "SELECT * ..." then each time the page will fetch the whole lot and
bind this to your grid, then depending on the paging, will decide what to
show.

To get around this, you need to take the paging information and use that to
select a subset of your datasource and only bind this to your grid... This
will make the postback far quicker.

Daniel.
 
G

Guest

Nevermind, I just ran a simple test and it seems only the displayed data is
encoded and sent.
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top