Hi,

I am new to asp.net development, and i'm currrently trying to develop my first web application. My question relates to making my site compliant with html coding standards. To test the generated html from an asp page I put together simple master and content pages with only some text and a button in the content pane. However, in the html this generated the below line in the source

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjQyNDIwNTI0D2QWAmYPZBYCAgMPZBYCAgEPZBYCAgUPPCs
ADQBkGAEFI2N0bDAwJENvbnRlbnRQbGFjZUhvbGRlcjEkR3JpZFZpZXcxD2dk9Yu8B
dQuYa4ficS70xgINaIrmYs=" />

When i then added more to the page, such as gridviews and dynamically built menus etc, this string became enormous making the html very messy. I am basically wondering is there anyway I can hide this code so that it doesnt show in the source?

Kindest Regards,

David.

This is due to the fact that Viewstate Property is enabled for Server Controls. It means that the value entered in a textbox and other controls for which Viewstate is enabled, is not lost when the Page is refreshed. The Viewstate acts like a hidden variable (in classic ASP) which stores the value of the textbox and replaces the value in the textbox when the page refreshes. This is the same principal at work when you enter a User and a wrong PWD. The User values is displayed again, but not the PWD-because it is not stored in Viewstate.

This article has been dead for over six months. Start a new discussion instead.