Skip to main content

ViewState and Scripting

  • Chapter
Expert ASP.NET 2.0
  • 210 Accesses

Summary

The ASP.NET Framework provides a rich set of features for leveraging client-side functionality, including JavaScript. The ViewState and ControlState features use HTML hidden input to store state information on the client, which saves you from writing a lot of redundant boilerplate code. However, you must carefully monitor ViewState because it can quickly bloat your requests and responses. Version 2.0 increases the efficiency of the hashing algorithms in use to generate the ViewState value, decreasing the size of the value stored in the hidden input. In some situations, the ViewState size will still cause an unacceptable performance hit; in these cases, you have the option of replacing the location where the ViewState value is stored with one of your choosing (like Session, Cache, or a database).

ASP.NET script-generation features have been aggregated and extended via the services the new ClientScript object provides. This object, a property of the Page object, exposes many methods you can use to generate JavaScript, and to avoid sending duplicate blocks of JavaScript to the client.

There is a powerful new facility for doing out-of-band callbacks from the client to the server, which allows you to do partial page refreshes and avoid the overhead of a full postback to the server.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Dominic Selly, Andrew Troelsen, and Tom Barnaby

About this chapter

Cite this chapter

(2006). ViewState and Scripting. In: Expert ASP.NET 2.0. Apress. https://doi.org/10.1007/978-1-4302-0073-4_4

Download citation

Publish with us

Policies and ethics