Click here to Skip to main content
15,896,486 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Which is better
viewstate OR globalvariable
Posted
Comments
srinivas vadepally 14-Jul-14 2:17am    
Could you detail your question?
[no name] 14-Jul-14 2:25am    
i want save one value (for example id)and read it on other method

ViewState is only used on a single page that handles postbacks request and results. Once you
redirect to the new page, the ViewState is lost.

Static Variable(global variables) will be shared across all instances of the page.Hence if you have two users of same aspx at the same time value is shared which is not good & I personally would suggest never use static variables in a web scenario.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900