none
Trouble with an Event Handler and Child/Parent Controls in ASP.NET RRS feed

  • Question

  • I am having a bit of trouble with an Event Handler and Child/Parent Controls. 

    I am working with an established code base that I did not build that has a User Control (we will call A) that allows, binds, and loads child controls dynamically.  I have built one of these child controls (we will call B).

     

    Question #1

    In the established code base that I did not build, A injects itself to handle the event of B using the command:

     

    AddHandler B.Ev_Event, AddressOf Me.EventHandler
    

     

    I would like to prevent the parent (A) from using its Private own EventHandler.  I have tried using the RemoveHandler in my B Event, but I am unable to and receive a syntax error in VS.  I suspect that since the A.EventHandler is private, I can not get at it and that is why I get the syntax error in VS.

    I do not know if it matters, but I can tell you that these user controls are in the name space Z.Y.X.A and Z.Y.W.B and both are run-time compiled.

    Any thoughts on how I can remove the binding to Me.EventHandler OR prevent the Me.EventHandler from firing?


    Question #2:

    In a related but slightly different situation I am trying to replace an event with my event.  In this case A also has child control C.  In the class for user control A, it has code that handles an event for C.  I would like to have control B remove the EventHandler in A for control C.

    Is it possible to remove an EventHandler for a sibling control?

     

    • Moved by Martin_XieModerator Monday, August 15, 2011 7:54 AM Redirect to ASP.Net Forum for better support. (From:Visual Basic General)
    Sunday, August 7, 2011 7:56 PM

All replies

  •  Hi Brilldav,

     
    Welcome to MSDN forums!
     

     

    Is this question about ASP.NET web control?

    If yes, you are more likely to get more efficient responses to ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.

     

    Thanks for your understanding and active participation.

     

     


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, August 9, 2011 8:22 AM
    Moderator
  • Thanks, I have posted it here: http://forums.asp.net/p/1708828/4546310.aspx
    Tuesday, August 9, 2011 2:05 PM