SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to call Page_Load event from other aspx file.?

    There are three file Default.aspx, Default1.aspx and Default2.aspx.. Is it possible to call remaining two pages if I click on a Button in the Default3.aspx .? The pages are individual.. If i click on a button in Default3.aspx the page_Load Event of the remaining two pages has to be called/processed... I am using ASP.NET 2.0 and C#. pls give me suggestion. If you send code its great.

    Thanks,

    Hosanna

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have code you want to fire from different pages, you would be better off creatinh a class and sticking it in the App_Code. Have a look here to get started: http://dotnetjunkies.com/QuickStartv...ages/code.aspx

  3. #3
    SitePoint Zealot vb_vs's Avatar
    Join Date
    Sep 2006
    Location
    Melbourne
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there are two method to execute the pages you want

    1 server.transfer("a.aspx")

    2 server.execute("a.asox")
    server.execute(b.aspx")

    the difference between server.transfer and server.execute :

    the server.transfer method execute current page firstly, then execte the other page using a specify URL to the page

    the server.execute method will continue to excute the original page after execting the new page
    a software developer

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,652
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    ^^^technically valid, but not a good idea in ASP.NET given the nature of the beast.

    You should really move shared code out of the individual pages into a class accessible to all pages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •