Solved

ASP.NET Web Form Variables being reset

Posted on 2016-11-16
2
27 Views
Last Modified: 2016-11-16
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
Comment
Question by:Thunder724
2 Comments
 
LVL 28

Accepted Solution

by:
Pawan Kumar earned 500 total points
ID: 41889602
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
 
LVL 4

Author Closing Comment

by:Thunder724
ID: 41889880
That was very helpful; thank you.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question