468,719 Members | 1,925 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,719 developers. It's quick & easy.

Datagrid viewstate contents?

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/de...sp11222001.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/Ar...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...

Nov 18 '05 #1
2 1501
Nevermind, I just ran a simple test and it seems only the displayed data is
encoded and sent.

"Dave" wrote:
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/de...sp11222001.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/Ar...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...

Nov 18 '05 #2
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.

"Dave" <Da**@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
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/de...sp11222001.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/Ar...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...

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Hermit Dave | last post: by
2 posts views Thread by Ben | last post: by
4 posts views Thread by Luis Esteban Valencia | last post: by
2 posts views Thread by pmanno | last post: by
10 posts views Thread by Jeff | last post: by
9 posts views Thread by rn5a | last post: by
2 posts views Thread by Nomen Nescio | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.