 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

February 22nd, 2012, 04:26 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
|
|
Chapter 4 - View State
Hi Imar,
I had a question on page 134. It says that you can turn off the View State at the web site level and Page level.
Should this affect code where the view state collection is being used to maintain the state? I tried turning this off at the web site and page levels and the state was still being maintained for the view state collection, but I just wanted to make sure.
Thank you.
Tulsi
|
|

February 22nd, 2012, 08:41 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
and the state was still being maintained for the view state collection
|
Which state are you referring to? Controls such as the TextBox maintain their state / value without ViewState as they submit their values to the server (through their HTML counterparts).
Cheers,
Imar
|
|

February 23rd, 2012, 03:01 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
|
|
I was referring to the View State properties for User Controls. They use the view state collection to maintain the state across postbacks.
I was wondering if turning off view state and the site and page level (p.134) is supposed to affect the View State properties for User Controls.
Thank you for you help and always replying so quickly to emails.
Tulsi
|
|

February 25th, 2012, 07:51 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
I was wondering if turning off view state and the site and page level (p.134) is supposed to affect the View State properties for User Controls.
|
Turning it off at the site level also turns it off at the UC level. Turning it off at the Page level does not affect the User Control.
Cheers,
Imar
|
|

February 27th, 2012, 02:20 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
|
|
I'm a little confused... I set enableViewState="false" in the web.config file (site level), but the view state properties are still working for the user control. I am referring to the NavigateUrl property on p. 288.
Is there anything else I need to do to turn off view state at the site level?
Tulsi
|
|

February 28th, 2012, 03:04 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The NavigateUrl property maintains its state using ViewState as the property code explicitly targets ViewState. That works, regardless of the setting on the Site, Page or UC level.
Turning it off does have affect on other controls such as the GridView.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
Tulsi (February 28th, 2012)
|
|
 |
|