how to peroform some action items when page unloads?
-
Hi, This is a basic question but since I am new with WEB development for me it is not so basic. I use asp .net 2.0 and C#. I have a page with some text boxes and other controls, the user can navigate from this page to some other pages using LinkButton. Can I run some code on the page (using c#) before the new page loads? I want to do it because I want to save some data in the Session object before loading the new page. I thought about using PostBackUrl, but that means I need to use it on each control that can perform "post" on the page? Do I have a simpler way doing so? I will appriciate any help. Thanks, Yossi
-
Hi, This is a basic question but since I am new with WEB development for me it is not so basic. I use asp .net 2.0 and C#. I have a page with some text boxes and other controls, the user can navigate from this page to some other pages using LinkButton. Can I run some code on the page (using c#) before the new page loads? I want to do it because I want to save some data in the Session object before loading the new page. I thought about using PostBackUrl, but that means I need to use it on each control that can perform "post" on the page? Do I have a simpler way doing so? I will appriciate any help. Thanks, Yossi
The link button should raise an event on the page it is on (view the form and double-click the link button, Visual Studio should create a default event handler and even take you to the code it created). You can save the session there and do either a Server.Transfer("nextpage.aspx") or context.Response.Redirect("nextpage.aspx") to move to the next page. Regards, Keith
-
Hi, This is a basic question but since I am new with WEB development for me it is not so basic. I use asp .net 2.0 and C#. I have a page with some text boxes and other controls, the user can navigate from this page to some other pages using LinkButton. Can I run some code on the page (using c#) before the new page loads? I want to do it because I want to save some data in the Session object before loading the new page. I thought about using PostBackUrl, but that means I need to use it on each control that can perform "post" on the page? Do I have a simpler way doing so? I will appriciate any help. Thanks, Yossi
A typical way to handle this is to set the values in the session variable when the page is rendered to the client. This way the session object will be available when the user navigates to the next page via the link provided. In ASP.NET 2.0 you can post back to a different page and have access to the previous page via the PreviousPage property. Depending on the information you need this may be better than storing data in a session variable.