In ASP.NET 4.0 we have some very interesting new enhancements and new features.
I will try to talk about all of them in separate posts.
In this post I will talk about Viewstate management in ASP.NET 4.0.
Let’s have a look first what really Viewstate is and what it really does.Unless you move to a new paradigm for building web applications like ASP.NET MVC you must have a good knowledge of Viewstate.
Viewstate represents the state of the page when it was last processed on the server. We use it to retain values across two successive requests for the same page. It is a hidden field added to the page and is restored on the server before the page request is processed. The Viewstate information travels back and forth with the page itself, but contains no visual elements that need to be rendered. So you must be thinking that this is fantastic news for the web developer. But (there is always a but), the extra information in the Viewstate adds to the size of the page and the information that travels down the wire. I have seen web pages that have an additional 20Kbytes of Viewstate information.
Every .aspx page derives from the Page class or Page control and extends it. The default value for the EnableViewState property for the page is True. Through that property we can get or set(enable-disable) the view state of the control. However, EnableViewState property is ignored for child controls. So if we have EnableViewState=True for the page, which is True by default, all the child elements on that page will have EnableViewState=True for their viewstate property. So if we type this txtname.EnableViewState = false , this will have no effect, since the textbox is the child of the .aspx page we are designing.
There is a mistake here. The opposite is actually true.If we disable ViewState on page level, you cannot enable it on child controls. if you go to the web.config and type
then if you try to enable it on child controls is impossible.
So to be absolutely clear, in asp.net 1.1,2.0.3.5 if you have ViewState enabled on page level , you can have it disabled for some controls you choose.
But if you disable it on page level(or application level) you cannot enable it for individual controls.
In ASP.NET 4.0 we have the ViewState property. There are 3 values for this property:enabled, disabled, inherit .
We can use this property to enable Viewstate for an individual control even if Viewstate is disabled for the page. We can disable the Viewstate for a control even if it is enabled on a page level.
Viewstate management in ASP.Net 4.0
Search
Categories
- .NET Framework (3)
- AJAX (3)
- ASP.NET (15)
- ASP.NET 4.0 (5)
- Avengers Infinity War (1)
- C# (1)
- Chess (1)
- Cricket (1)
- Downloads (1)
- Emails (1)
- Ending explained (1)
- General (20)
- gujarat (3)
- Mobiles (1)
- New thing A Day (1)
- Poems (1)
- Programming (1)
- Reviews (1)
- SeminarTopics (1)
- Songs (1)
- SQL Scripts (1)
- Sql Server (3)
- State Server (1)
- Tech (1)
- Visual Studio (6)
Archives
-
▼
2010
(70)
-
▼
January
(47)
- Convert Data Reader to Data Table
- Convert data table to data reader
- 30 Common String Operations in C# and VB.NET
- Use .NET Built-in Methods to Save Time and Headaches
- Laws of Computer Programming
- T-SQL: Recently Executed Query
- Limiting the length of a multiline textbox
- Setting the default Button for a TextBox in ASP.NET
- Had a Gr8 time @PUG Developer Summit - 16th Jan 2010
- SQL Server performance with NOCount On
- Design pattern – What can they mean?
- Asp.net 4.0 FormView Control Enhancement
- Programmatically set the Page Description and Keyw...
- Important SQL Server and Windows “End of Support” ...
- how to change Visual Studio's default browser
- Access Viewstate across pages in ASP.NET
- How to refresh an UpdatePanel from javascript
- Maintain Scroll Position On Postback in ASP.NET
- Using ICALLBACKEventHandler in ASP.NET
- Building a Custom Confirmation Dialog Box
- List of Best Open Source Software
- List of Best Open Source Software
- 10 investment resolutions for 2010
- How smart is your right Foot…????
- The Alcohol Guide
- The Blood Donation Guide
- ADOBE AIR- The Revolution has just started
- Myths about code comments
- Parameter passing in C#
- Strings in .NET and C#
- Concatenating Strings Efficiently - When to use St...
- Memory in .NET - what goes where
- .NET Cheat Sheets
- Viewstate management in ASP.Net 4.0
- Visual Studio 2010 Beta2 new features.
- New Features in VB.NET
- MSVBRUN, MSVCRT, CLR and now DLR. WTH?
- Ajax, Asp.net Ajax, jQuery – Misconceptions and Facts
- Top 10 Upcoming Microsoft Releases That Developers...
- Twitter - Saving your Tweets
- How to get Sql server 2008 intellisense working fo...
- How to display latest tweet in your website using ...
- What is new in ASP.Net 4
- Gear up for a Stream of new Products from Microsoft
- ASP.NET 2.0 Session State Partitioning
- Using AJAX Textbox Extenders
- Happy 2010
-
▼
January
(47)
0 Comments Received
Leave A Reply