• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 59
  • Last Modified:

ASP.NET Web Form Variables being reset

Hi all,
I have a Web Form with some code behind variables.  When selecting a grid view control the variables are set; but when pressing a button on the form the variables get reset to when the form was created.  Can someone tell me how to persist variables so that the form refreshing or whatever it's doing wont wipe out my variables?
0
Thunder724
Asked:
Thunder724
1 Solution
 
Pawan KumarDatabase ExpertCommented:
try..

Many Options are there - you can choose based on your need.

ViewState["YourVariable"] = "Pawan";

Session["YourVariable1"] = "Ramesh";

Read more at-

http://www.aspsnippets.com/Articles/Persist-Data-Object-Variable-values-across-PostBack-in-ASPNet.aspx

Hope it helps !!
0
 
Thunder724Author Commented:
That was very helpful; thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now