Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to peroform some action items when page unloads?

how to peroform some action items when page unloads?

Scheduled Pinned Locked Moved ASP.NET
csharpquestionhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    YossiKahlon
    wrote on last edited by
    #1

    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

    K N 2 Replies Last reply
    0
    • Y YossiKahlon

      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

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • Y YossiKahlon

        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

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups