473,473 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

User Control Event Not Firing

Hi All,

I am trying to raise a custom event from a user control. I have supplied my
code below. It calls OnSave method that attempts to raise the save event,
but it never gets to the handler in the default.aspx.vb file.

[registration.ascx]
Public Event Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)

Protected Overridable Sub OnSave(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
RaiseEvent Save(sender, e)
End Sub

[default.aspx]
<%@ Register TagPrefix="cs" TagName="RegistratonForm"
src="./controls/RegistrationFormTable.ascx" %>
...
<cs:RegistratonForm ID="RegistratonForm" Runat="server"
Visible="False"></cs:RegistratonForm>
...

[registration.ascx.vb]
Dim e As RegistrationFormEventArgs

Try
e = New RegistrationFormEventArgs([My Parameters Go Here])
OnSave(Me, e)

If e.Saved Then
ClearForm()
Else
MessageLabel.Text = "Save Failed. " & e.ErrorMessage
End If

Catch ex As Exception
RaiseException(ex)

Finally
e = Nothing

End Try

[default.aspx.vb]
Private Sub RegistrationForm_Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs) Handles RegistrationForm.Save
Try
..

Catch ex As Exception
RaiseException(ex)

e.Saved = False
e.ErrorMessage = ex.Message

End Try

End Sub
Any ideas?

Landers
Nov 19 '05 #1
1 1118
Ignore this posting. I need to learn how to spell!

L.

"Landley" <ne**@creations-software.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi All,

I am trying to raise a custom event from a user control. I have supplied my code below. It calls OnSave method that attempts to raise the save event,
but it never gets to the handler in the default.aspx.vb file.

[registration.ascx]
Public Event Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)

Protected Overridable Sub OnSave(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
RaiseEvent Save(sender, e)
End Sub

[default.aspx]
<%@ Register TagPrefix="cs" TagName="RegistratonForm"
src="./controls/RegistrationFormTable.ascx" %>
..
<cs:RegistratonForm ID="RegistratonForm" Runat="server"
Visible="False"></cs:RegistratonForm>
..

[registration.ascx.vb]
Dim e As RegistrationFormEventArgs

Try
e = New RegistrationFormEventArgs([My Parameters Go Here])
OnSave(Me, e)

If e.Saved Then
ClearForm()
Else
MessageLabel.Text = "Save Failed. " & e.ErrorMessage
End If

Catch ex As Exception
RaiseException(ex)

Finally
e = Nothing

End Try

[default.aspx.vb]
Private Sub RegistrationForm_Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs) Handles RegistrationForm.Save
Try
..

Catch ex As Exception
RaiseException(ex)

e.Saved = False
e.ErrorMessage = ex.Message

End Try

End Sub
Any ideas?

Landers

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Timothy V | last post by:
Hi everyone, I hope you can help me. I have a User Control, which has a Label that covers the entire control. I want to assign a MouseClick event to the User Control, however, the event does not...
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
1
by: Raed Sawalha | last post by:
I am trying to sort a DataGrid in a user control that is programatically loaded when a link button is clicked. UC1 is loaded onto Page1.aspx after clicking a link button. No problem, loads fine....
2
by: ~~~ .NET Ed ~~~ | last post by:
I have a problem (don't we all?). I have a web form with multiple modules, some of these modules have an ASP.NET (server run) button. OK, now I have UserControlX which has one such button (say...
3
by: Don | last post by:
I have a User Control called Menu that is used in another User Control called header. It seems the button clicked event in the first control (Menu) is not firing. If I click a button on the...
4
by: thomson | last post by:
Hi all, i do have a user control with 4 buttons, and all the events are firing properly, My problem is that i need to right an event handler in the user control, which gets fired after a...
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
2
by: tshad | last post by:
In VS 2008, I have 2 pages, one aspx page and one ascx page. The PreRender event is not firing on the Contol page. The aspx page starts out: <%@ Page Language="VB" AutoEventWireup="true"...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.