Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ViewstateEnabled=False

ViewstateEnabled=False

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elena2006
    wrote on last edited by
    #1

    Hi, There are two textboxes and one button control in a Web page. We change the setting as ViewstateEnabled=False to both the textboxes. In button click event we have written the code to display TextBox1 value in TextBox2. The value is displaying in TextBox2 as well as it didn't remove from TextBox1 also even if both the textboxes ViewstateEnabled=False. What is the reason? Please answer. Thanks in advance

    C N A 3 Replies Last reply
    0
    • E Elena2006

      Hi, There are two textboxes and one button control in a Web page. We change the setting as ViewstateEnabled=False to both the textboxes. In button click event we have written the code to display TextBox1 value in TextBox2. The value is displaying in TextBox2 as well as it didn't remove from TextBox1 also even if both the textboxes ViewstateEnabled=False. What is the reason? Please answer. Thanks in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Please buy a basic book on ASP.NET and read it before asking all these questions.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • E Elena2006

        Hi, There are two textboxes and one button control in a Web page. We change the setting as ViewstateEnabled=False to both the textboxes. In button click event we have written the code to display TextBox1 value in TextBox2. The value is displaying in TextBox2 as well as it didn't remove from TextBox1 also even if both the textboxes ViewstateEnabled=False. What is the reason? Please answer. Thanks in advance

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Elena2006 wrote:

        The value is displaying in TextBox2 as well as it didn't remove from TextBox1 also even if both the textboxes ViewstateEnabled=False. What is the reason?

        Well, the value you are seeing in text box are not loaded from viewstate. It will be loaded from the post back data. When you press the button, all the control values in the form will be send to server. When page renders, ASP.NET is capable to assign the values back to each controls correctly. To see viewstate in action here, consider changing some properties of text box in page_load event. When viewstate is disabled for text box, you can see the changed property details are not persisting across post backs. :)

        Navaneeth How to use google | Ask smart questions

        1 Reply Last reply
        0
        • E Elena2006

          Hi, There are two textboxes and one button control in a Web page. We change the setting as ViewstateEnabled=False to both the textboxes. In button click event we have written the code to display TextBox1 value in TextBox2. The value is displaying in TextBox2 as well as it didn't remove from TextBox1 also even if both the textboxes ViewstateEnabled=False. What is the reason? Please answer. Thanks in advance

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          For the answer, first of all you need to know what actually happened during ASP.NET Page life cycle and ViewState. In the ASP.Net page life cycle, two events related with View State. 1. Load View State : Where view state data is loading for the control and which happened before Page_Load. 2. Save View State : Where control data store in a hidden field before the Page_Render. Now, If you disable the ViewState for the control it should store the view state data but, you are saying in Textbox, after you disabled the view state , control holds the data after postback, Here is the Trick, There is another event fired during Page Life Cycle, which is, Load PostBack Data :) ASP.NET controls which implement IPostBackEventHandler will load its value from the appropriate postback data. This value is not read from view state but from Postback From and this is true for those control which implements the IPostBackEventHandler and TextBox is one such control Wink Hope this clears your doubts and This will helps you.

          cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net When you ask a question, remember to click "Good Answer", If the Answer is helps you.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups