Re: Inherited Control Does Not Handle All Events
- From: "Jeff" <jeffmagill@xxxxxxxxx>
- Date: 4 Dec 2006 14:05:19 -0800
I did not define the events or their handlers.
It almost seems like since the classes I am interested in are being
inherited from a class that doesnt explicitly define these events, that
they arent getting them. That doesnt really make sense to me though
since everything should be inherited across every level. I have tried:
Private Sub InsertButton_Click(ByVal sender As Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles MyBase.Click
debugme() '<--- breakpoint here never hits
End Sub
with no luck. However, similar code in the BaseIconButton hits fine.
Again, I want to say that it seems like the second generation inherited
classes arent inheriting these events.
GJH wrote:
Did by chance you add the click Events in the class and leave them blank?
In your class file does something like this work?
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
Me.EnsureChildControls()
End Sub
Private Sub DeleteButton_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles MyBase.Click
Page.Response.Write("hi")
End Sub
"Jeff" <jeffmagill@xxxxxxxxx> wrote in message
news:1165257116.912044.4970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello everyone,
I'm building a series of custom controls inherited from an ImageButton
and certain events are never getting thrown, or at least their handlers
in the code are never running. Init, Load, DataBinding, PreRender and
Unload are all working fine. Click, Command and Dispose never get run.
Does anyone have any idea why this might be happening?
My basic hierarchy, should that be important, is as follows:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class BaseIconButton
Inherits ImageButton
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class DeleteButton
Inherits BaseIconButton
Public Class InsertButton
Inherits BaseIconButton
Public Class EditButton
Inherits BaseIconButton
Public Class UpdateButton
Inherits BaseIconButton
Public Class CancelButton
Inherits BaseIconButton
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
It is the events for the second group of classes that I cannot capture.
If I test a BaseIconButton, then everything works perfectly.
Thanks
.
- References:
- Prev by Date: Re: Custom Datagrid disappearing on Postback
- Next by Date: Property Array in Custom Web Control
- Previous by thread: Re: Inherited Control Does Not Handle All Events
- Next by thread: Property Array in Custom Web Control
- Index(es):
Loading