ASP.NET - Render Hidden Fields at the Top of a Form with .NET 3.5 SP1

Posted on July 22, 2008 by dwahlin.
Categories: ASP.NET, Contributors.

I just came across a nice feature in ASP.NET 3.5 SP1 (currently in Beta) that I didn’t realize was included.  It’s always nice to discover hidden gems from time to time.  With ASP.NET 1.0, 1.1, 2.0 and 3.5 applications if a user or JavaScript function tried to do a postback before all of the ViewState and EventValidation data was loaded in the browser, a ViewState MAC validation error could be raised by the server.

In ASP.NET 3.5 SP1 Microsoft provides a new attribute on the <pages> element in web.config that now allows all hidden fields to be rendered at the top of a form rather than at the bottom which can help to avoid the ViewState MAC validation error when people perform a postback operation before the page has finished loading.  The attribute is named renderAllHiddenFieldsAtTopOfForm (which does what it says) and defaults to a value of true.  .NET 3.5 SP1 is currently in beta but once it’s officially released the new attribute is definitely a nice enhancement to the ASP.NET framework.

 

 

Need to display OrgCharts, site maps or other hierarchies in your ASP.NET applications?  Check out SmartChartPro.

no comments yet.

Leave a comment

Names and email addresses are required (email addresses aren't displayed), url's are optional.

Comments may contain the following xhtml tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>