473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1651
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**@discussio ns.microsoft.co m> wrote in message
news:53******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1069
by: Hermit Dave | last post by:
Hello folks, Attaching some code from one of my pages... the paging on this page used to work just fine.... when i click next it doesnt even come anywhere near the DataGrid1_PageIndexChanged handler... tried step by step debug... just exits after the page_load when i try to move to the next page... Any ideas would be appreciated.... using System; using System.Collections;
2
4000
by: Ben | last post by:
Hi, I'd like to have a datagrid that has a dropdownlist in the pager control for setting the page size. I can get the control into the pager inside the datagrid itemcreated event by checking for ListItemType.Pager. The problem I'm having is subscribing to the selectedindex changed event. The datagrid doesn't even seem fire an itemcommand, but that's ok, just the selectedindex changed event would do... Any advice is greatly appreciated!
4
2079
by: Luis Esteban Valencia | last post by:
I have a asp.net page (C#), with a datagrid. I use template for all columns, and have <asp:requiredfieldvalidator> in with one of the textboxes, to make sure it's filled in. However, this validation is not firing, even when I leave the field empty. Below please find the code: <%@ Page Language="C#" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %>
8
1915
by: Jeff | last post by:
Hi - I'm having trouble Databinding a SQLDataReader to a DataGrid control. I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in a directory of my localhost on my development machine. The database is on the web. When I run the app on the local machine, IE opens, loads my aspx page from localhost, and hangs. (Eventually I get a page cannot be displayed error.)
2
1355
by: pmanno | last post by:
If I have a page with a DataGrid that is bound to a DataTable that is populated by a query to a database and I want to enable sorting and paging, do I have to add the DataTable to the cache or will the viewstate hold the contents of the DataTable? Basically, I want to avoid hitting the database wherever I can. It seems that the DataTable has to be cached and the DataGrid re-bound, or the DataTable has to be re-populated from the...
1
1878
by: Ken Varn | last post by:
I have a problem where my DataGrid would not maintain the ViewState of my databound rows. I finally narrowed down the problem. If my first column is a template column, the view state for the DataGrid items is not maintained on postback for some reason. I basically re-created my DataGrid again just to make sure this was indeed the problem. The ViewState was fine until I added the template column at the beginning of the Columns list. ...
10
2716
by: Jeff | last post by:
Is there a workaround for datagrid contents being lost on postback? All other controls persist. It's just datagrids that appear to be reinitialized. It doesn't make sense to continually rebuild datagrids on postback when other controls don't require it. Thanks in advance.
9
2727
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
2
1213
by: Nomen Nescio | last post by:
Hi, I have a Datagrid with template columns (TextBox and Radiolist in them). When I type something in the textbox and push a radiobutton and subsequently push another button (not part of the datagrid) the contents isn't restored on the round-trip, even though the Viewstate for the Datagrid and the controls is set to 'true'. Anyone have a clue what the problem could be? Someone told me there are 'problems' with the Viewstate in the...
0
9790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9779
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9645
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8645
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.