Solved

ASP.NET Web Form Variables being reset

Posted on 2016-11-16
2
41 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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