Programing and Manipulating the .Net ListItem

Posted by Elliott Nash | Filed under , , , ,

How to use .Net ListItem in the real world

When starting out with .Net the built-in server controls can appear a bit daunting - especially if coming from a classic ASP or PHP background (where you simply write HTML elements out as a string). In this post i will run through an every day example of how to use a ListItem to display data and customise the output via the ItemTemplate.

A .Net ListItem can be used to bind data from a datasource (SQLDataReader, DataTable, ArrayList, GenericList etc...) to display to the end user. The display can be customised through the use of the <itemTemplate> as follows: More...

Validation of viewstate MAC failed

Posted by Elliott Nash | Filed under , , , , ,

I was simply attempting to post a form from one page to another when i encountered the following error:

HttpException (0x80004005): Validation of viewstate
MAC failed
. If this application is hosted by a Web
Farm or cluster, ensure that configuration
specifies the same validationKey and validation
algorithm. AutoGenerate cannot be used in a cluster.

It seems when developing with .NET 2.0 or later there is a bug in the framework which can become apparent if the following conditions are true: More...