Inherited Control Does Not Handle All Events

J

Jeff

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
 
G

GJH

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
 
J

Jeff

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top