In my C# codebehind file(.cs), I have just one class and it is derived from System.Web.UI.Page. The class contains array of dictionaries. On one of the button clicks i.e. in the button click event handler function, I create object of this class and do something. Now, on another button click, I need to do something else which needs data belonging to the object or instance of the class created on previous button click. How can I achieve this? I need all the data especially array of dictionaries belonging to that object/class instance.
Share
HTTP is stateless. So there is no direct way to do this.
What you can do is keep this in some storage mechanism and access it later. You may consider DB
table,Sessionetc…Here is an example to store in
SessionYou can access this in the next button click event like this
It is not a good idea to store so many items in session as it will make your server cry since sessions stored in server.