Canceling Page.Load event

Discussion in 'ASP .Net' started by AT, Aug 18, 2005.

  1. AT

    AT Guest

    I have an aspx page with this code behind

    Public Class WebForm1
    Inherits Class1

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    ' Derived
    Return
    End Sub

    End Class

    And a Class

    Public Class Class1
    Inherits System.Web.UI.Page

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    ' Base
    Return
    End Sub

    End Class

    When asp page is loaded base event fires first. Then derived class event
    fires.
    How can I conditionally prevent derived class Page_Load event from firing?

    Thanks.
    --
    Regards.
    _____________________________________
    AT
     
    AT, Aug 18, 2005
    #1
    1. Advertisements

  2. AT,

    You really can't. If you need to do this you need to really review your
    design - a lower level class shouldn't have to make decisions about whether
    and how higher level methods operate.

    You can of course do a REsponse.End() to cancel all operation, which is a
    brute force way of doing things...

    +++ Rick ---

    --

    Rick Strahl
    West Wind Technologies
    www.west-wind.com
    www.west-wind.com/weblog


    "AT" <> wrote in message
    news:%...
    >I have an aspx page with this code behind
    >
    > Public Class WebForm1
    > Inherits Class1
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > ' Derived
    > Return
    > End Sub
    >
    > End Class
    >
    > And a Class
    >
    > Public Class Class1
    > Inherits System.Web.UI.Page
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > ' Base
    > Return
    > End Sub
    >
    > End Class
    >
    > When asp page is loaded base event fires first. Then derived class event
    > fires.
    > How can I conditionally prevent derived class Page_Load event from firing?
    >
    > Thanks.
    > --
    > Regards.
    > _____________________________________
    > AT
    >
     
    Rick Strahl [MVP], Aug 19, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WFB
    Replies:
    1
    Views:
    2,791
    Charlie Nilsson [MSFT]
    Dec 30, 2003
  2. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,458
    venky
    Jul 11, 2005
  3. GauravGupta
    Replies:
    4
    Views:
    2,452
    Shilpa1234
    Jan 19, 2012
  4. Mufasa
    Replies:
    3
    Views:
    335
    Mufasa
    Feb 13, 2008
  5. lander
    Replies:
    5
    Views:
    2,832
    Mark Rae [MVP]
    Mar 3, 2008
  6. Matcon
    Replies:
    3
    Views:
    22,112
    Matcon
    May 28, 2008
  7. Lubomir
    Replies:
    0
    Views:
    592
    Lubomir
    Feb 5, 2010
  8. Event canceling...

    , May 22, 2006, in forum: Javascript
    Replies:
    1
    Views:
    191
    Randy Webb
    May 22, 2006
Loading...