Results 1 to 8 of 8
  1. #1
    rkraj's Avatar
    rkraj is offline Junior
    Join Date
    May 2010
    Location
    India
    Posts
    176
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Feedback Score
    0

    Default What is viewstate in ASP?

    What is viewstate in ASP. What is the pros and cons of this

  2. #2
    manik's Avatar
    manik is online now Om Shanti!
    Join Date
    Apr 2008
    Location
    Boston, USA
    Posts
    13,172
    Thanks
    744
    Thanked 699 Times in 550 Posts
    Blog Entries
    4
    Feedback Score
    4 (100%)

    Default

    webpages are stateless. which means server forgets about the content of the page after serving. viewstate is a way of letting the server know what was the previous states of a page, when you make a click or do something on the page and send the request to the server.

    pros: easy to code
    cons: page size gets larger
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  3. #3
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    103
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Feedback Score
    0

    Default

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

    Syntax:-

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

  4. #4
    somkant is offline Senior
    Join Date
    Aug 2011
    Posts
    671
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Feedback Score
    0

    Default

    view state is a state management technique in asp.net. ASP.NET Viewstate is preserving the data between the requests or postbacks and stored in hidden fields on the page.

  5. #5
    gaurav467 is offline Banned
    Join Date
    Jul 2011
    Posts
    45
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    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.

  6. #6
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.

  7. #7
    poibase is offline Sophomore
    Join Date
    Jul 2011
    Posts
    104
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    when page runs on server it didn't save the state of the page if you want to check the state of previous page than use view state..
    pors:- to view the state of the page, esay to manage
    cons:- we have to implement large coding method to maintain the state of the page.

  8. #8
    churchwebsite is offline Freshman
    Join Date
    Mar 2012
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    ASP.NET page framework uses to preserve page and control values between round trips. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during postback are serialized into base64-encoded strings.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •