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. Accessing ViewState in ClientSide Script

Accessing ViewState in ClientSide Script

Scheduled Pinned Locked Moved ASP.NET
toolsquestion
4 Posts 2 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.
  • C Offline
    C Offline
    chintan1979
    wrote on last edited by
    #1

    Hi, Can I access my ViewState in Client Side Script ? If Yes then How ? Thanks in advance !! Chintan

    M 1 Reply Last reply
    0
    • C chintan1979

      Hi, Can I access my ViewState in Client Side Script ? If Yes then How ? Thanks in advance !! Chintan

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, Yes, you can. Basically, the ViewState data is stored in a hidden input elemenent named __VIEWSTATE, you can view source the web page for more information. To access the value, you first get refererence to the hidden element as you would with other elemenents like textbox ..., then get its value. However, If you plan to change something in the ViewState data, then it may cause the error when the ViewState data is posted back to the server.

      C 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, Yes, you can. Basically, the ViewState data is stored in a hidden input elemenent named __VIEWSTATE, you can view source the web page for more information. To access the value, you first get refererence to the hidden element as you would with other elemenents like textbox ..., then get its value. However, If you plan to change something in the ViewState data, then it may cause the error when the ViewState data is posted back to the server.

        C Offline
        C Offline
        chintan1979
        wrote on last edited by
        #3

        Hi, Thanks for your reply. Yes, I can access __ViewState element in the jave script. But its value will be encrypted. How to access a particular index of the ViewState? For e.g. if in my Code Behind File this is the statement I am writting in the Load. ViewState["Name"] = "Chintan"; How can I access the value of ViewState["Name"] in my Client Side Java Script Function ? Thanks in advance !! Chintan

        M 1 Reply Last reply
        0
        • C chintan1979

          Hi, Thanks for your reply. Yes, I can access __ViewState element in the jave script. But its value will be encrypted. How to access a particular index of the ViewState? For e.g. if in my Code Behind File this is the statement I am writting in the Load. ViewState["Name"] = "Chintan"; How can I access the value of ViewState["Name"] in my Client Side Java Script Function ? Thanks in advance !! Chintan

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          There are two commonly used ViewState Decoder tools which you might want to checkout: http://www.wilsondotnet.com/Demos/ViewState.aspx[^] http://www.pluralsight.com/tools.aspx[^]

          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