473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Catching events in web form fired by user control

I'm trying to process an event raised by a user control in the web
form
that contains that control. I've fathomed out how to handle the event
within the control but how can I then pass it on to the parent web
form?

Thanks,

Nick
Nov 17 '05 #1
1 2549
You have a couple of ways of doing this. You can either
bubble the even using the RaiseBubbleEvent method in the
user control and overriding the OnBubbleEvent method in
the WebForm, or you can explicitly declare and raise an
event from your user control and catch it in your WebForm.
For example, if you wanted to ripple a Button click...

In UserControl:
....
Public Event SaveClicked(ByVal sender As Object, ByVal e
As System.EventArgs)
....
Private Sub btnSave_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles btnSave.Click
RaiseEvent SaveClicked(sender, e)
End Sub
In WebForm:

Private Sub MyUserControl_SaveClicked(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
MyUserControl.SaveClicked
'Do Something...
End Sub

That should work (although I've just type it from memory,
so there may be some syntax errors or typos...)
-----Original Message-----
I'm trying to process an event raised by a user control in the webform
that contains that control. I've fathomed out how to handle the eventwithin the control but how can I then pass it on to the parent webform?

Thanks,

Nick
.

Nov 17 '05 #2

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

Similar topics

4
by: Bren | last post by:
I am having problems with custom events raised by an object, if an aspx form is the event sink - I had posted earlier about this and found I was having problems changes in the UI not reflected...
0
by: spammy | last post by:
Hi all, I have a windows form that uses an imported COM class to talk to a legacy system. The COM object works asynchronously - An event is fired when data has been returned. This works...
4
by: Gaz | last post by:
This is impossible right?? This is a very simplified description of my form so don't worry if it sounds like I could do it a different way, it's just because I have simplified it. I have two...
3
by: yuval | last post by:
Hi DragDrop event is fired by the control accepting the drop If the drop is performed outside the controls I'm watching with events (like on another control/panel/window or outside my app) is...
6
by: gavin | last post by:
hi guys, I have a query about c# event handling that should be obvious I am sure - but I am confused :-) Lets say I have two classes. One is a user control with a tabcontrol on it The other...
0
by: Nick Lewis | last post by:
I'm trying to process an event raised by a user control in the web form that contains that control. I've fathomed out how to handle the event within the control but how can I then pass it on to...
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...
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...
0
by: hmm | last post by:
Hi all I have two problems: Problem #1: I'm using a .NET Form with the property 'FormBorderStyle' set to 'None'. The idea is to completely cover the area of that Form with a UserControl. In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.