Reputation: 321
What should I use to store a vlaue that is used by a number of methods of the same page ? It will not be used in other pages but will be used across postbacks . Do I use static variable or session or hiddenfield or something else ?
Thanks a lot .
Upvotes: 0
Views: 1233
Reputation: 3412
It's up to You to decide which way is best for you: viewstate, hidden field, session, database record and etc. For your question looks that best answer: viewstate.
Upvotes: 5
Reputation: 15253
int someValue = 123;
Session["SomeValue"] = someValue;
someValue = (int)Session["SomeValue"];
Upvotes: 0