Accessing ViewState in ClientSide Script
-
Hi, Can I access my ViewState in Client Side Script ? If Yes then How ? Thanks in advance !! Chintan
-
Hi, Can I access my ViewState in Client Side Script ? If Yes then How ? Thanks in advance !! Chintan
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. -
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.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
-
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
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[^]