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. Advertising

  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. Advertising

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. DazedAndConfused

    Canceling Subsequent events from page_load

    DazedAndConfused, Sep 22, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    532
    DazedAndConfused
    Sep 23, 2005
  2. Mufasa
    Replies:
    3
    Views:
    280
    Mufasa
    Feb 13, 2008
  3. Matcon
    Replies:
    3
    Views:
    21,591
    Matcon
    May 28, 2008
  4. Lubomir
    Replies:
    0
    Views:
    503
    Lubomir
    Feb 5, 2010
  5. Event canceling...

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

Share This Page