Mohd Shahab
what is view state in
By Mohd Shahab in ASP.NET on Jun 01 2011
  • kalit sikka
    Jun, 2011 17

    View state is a mechanism of the to persist the state of web forms i.e. web control during the postbacks. View State uses the hidden fields to do the same.

    • 0
  • sajid shahsroha
    Jun, 2011 3

    ViewState is a client side state management tool,which can contain information in the form of object.If information is stored in a viewstate,that information will be retained in roundtrip(Browser ->Server ->Browser)

    • 0
  • Dinkar Chavhan
    Jun, 2011 2

    ViewState is the mechanism that allows state values to be preserved across page postbacks.

    Because of the stateless nature of web pages, regular page member variables will not maintain their values across postbacks.  When we need a page variable to maintain its value across page post backs, we can use ViewState to store that value.  Values stored in ViewState will be serialized and sent to the client browser as the value of a hidden form input.  When you view the page source (in your browser) of a page the uses ViewState, you may see this hidden viewstate input which will look something like this:

    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTM1ODM3Nj......." /> 

    This single hidden field contains all the viewstate values for all the page controls. This is an important aspect of viewstate that you need to consider. 

    Because viewstate is (by default) sent to the client browser and then returned to the server in the form of a hidden input control on your page, storing a significant amount of data in viewstate can increase your page size and can affect your page performance.

    To disable ViewState for a control, you can set the EnableViewState property to false.  When ViewState is disabled for any control, it will also automatically be disabled for all child controls of that control. 


    • 0
  • Sandeep Shekhawat
    Jun, 2011 1

    View state is a method to store value (property) of page and controls on same page between  post back. By default each control view state enabled.

    • 0

Most Popular Job Functions