473,606 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

notification techniques in nested user controls

Hi,

I have a Form with many UserControls on it. Some of the UserControls contain
other Controls.
What is the best way of notifying each of the nested controls about an event
that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark
Nov 16 '05 #1
2 1740
Hi Marek
No, there is no any mechanism that will automate that for you. The only
mechanism that WindowsForms supports are events. But each control that wants
to be notified needs to hook on that event.

The easiest way I believe (ofcourse it is not a painkiller and might be not
suitable for some projects) is to declare helper serivice class that
exposes a static public events and respective public static raise methods.
This way the events are accessible to any object that wants to hook on them
and any object can raise some of those events using the RaiseXXX methods if
wants to notify the others. Over simmilar pattern VS, for example, is built.
Ofcourse they have more powerful and flexible service system (with service
containers and stuff) rather than static events.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

"Marek" <ma************ **@sbcglobal.ne t> wrote in message
news:ZS******** **********@news svr17.news.prod igy.com...
Hi,

I have a Form with many UserControls on it. Some of the UserControls
contain other Controls.
What is the best way of notifying each of the nested controls about an
event that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark

Nov 16 '05 #2
Thank you for your help.

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi Marek
No, there is no any mechanism that will automate that for you. The only
mechanism that WindowsForms supports are events. But each control that
wants to be notified needs to hook on that event.

The easiest way I believe (ofcourse it is not a painkiller and might be
not suitable for some projects) is to declare helper serivice class that
exposes a static public events and respective public static raise methods.
This way the events are accessible to any object that wants to hook on
them and any object can raise some of those events using the RaiseXXX
methods if wants to notify the others. Over simmilar pattern VS, for
example, is built. Ofcourse they have more powerful and flexible service
system (with service containers and stuff) rather than static events.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

"Marek" <ma************ **@sbcglobal.ne t> wrote in message
news:ZS******** **********@news svr17.news.prod igy.com...
Hi,

I have a Form with many UserControls on it. Some of the UserControls
contain other Controls.
What is the best way of notifying each of the nested controls about an
event that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark


Nov 16 '05 #3

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

Similar topics

1
2613
by: DotNetGuru | last post by:
Hi, I have nested User Controls like below. User_Control_1 User_Control_11 User_Control_12(contains method DisplayMessage) User_Control_2(contains event onButtonClick ) User_Control_1 and User_Control_2 are loaded in the PAGE_LOAD of a
3
1949
by: Guadala Harry | last post by:
I have this scenario: ASPX Page dynamically loads userControl1 - which in turn dynamically loads userControl2. UserControl2 contains a TextBox Web Server control. When a user clicks a button in the ASPX page (not in either user control), a Postback occurs during which I'd like to retrieve the Text property value of the TextBox control. I have plenty of examples to work from that show how to retrieve a property value of a user control...
5
5326
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a web form who has several other (user & custom) controls, these are enclosed within the standard FORM tag. Additionally *some* of these user controls are actually forms as well. This results into nested Forms.
2
1691
by: nulldevice | last post by:
I've got a datagrid with some nested controls, created at design-time. The controls themselves have no databound values. After a few other operations on the page (selecting a few parameters, etc), a button is clicked and the databind occurs. This part works fine. It retreives the 4-10 rows it needs and using the itemdatabound formats everything nicely. What I intend to do then, is after the user has gone through the nested controls...
20
10803
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of either an option button plus two text fields or a checkbox plus two text fields Am wanting to save the user entries into an underlying table. Tag property for each option button, check box or text field has the value of the key
2
1720
by: aarf | last post by:
Does anyone have an opinion or fact if nested user controls are a best practice, especially if you want performance from the page? I've seen pages that nest about 4 levels of user controls. Thanks
2
2404
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and answer dialog. The user answers a question, and the next subquestion appears (using dynamic html display:none|block) depending on his answer.
2
1884
by: Sebastian Paul | last post by:
Hi, I have a user control (EventStructureSelector) used in another user control (ResultsMenu). The class EventStructureSelector defines a public type (ModeType), that is used for one of its properties (Mode). The class ResultsMenu sets the property of the nested control during the PageLoad event. No big thing for now.
2
4723
by: Frank Rizzo | last post by:
I have an app, which has a composite User Control which includes other User Controls. The problem is that when I drop the composite user control on the form, the nested User Controls think that they are in the runtime mode. It seems like whenever the controls are in 2-deep in relation to the top container, they think they are in run mode. Is there a fix to this issue? VS 2005, SP1. Regards
0
8015
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7951
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8430
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8305
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6770
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5966
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3930
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.