473,387 Members | 1,904 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,387 software developers and data experts.

Cross user control communication via parent control

Here is the page architecture:
Page loads multiple user controls (including nested user controls)
dynamically based on parameters provided into place holders. Note: The
page only has the logic to load the user controls and subscribe to
custom event exposed in the user controls.

Scenario:
User comes to this page fills the fields generated by multiple user
controls and then hits "Save" button in one of the forms.

Question:
- How can all the information be collected in the control that has the
save button and saved to a repository?
- Is there a better practise?
- How can all the user controls be "wired" together to cross
communicate?

An example will be great help.

- Working with ASP.Net 2.0 using C#

Thanks in advance.

Jul 18 '07 #1
1 4721
<ze***********@hotmail.comwrote in message
news:11*********************@z24g2000prh.googlegro ups.com...
Here is the page architecture:
Page loads multiple user controls (including nested user controls)
dynamically based on parameters provided into place holders. Note: The
page only has the logic to load the user controls and subscribe to
custom event exposed in the user controls.
Did you not see my reply to you? Here it is again:
-------------
"zb" <ze****@gmail.comwrote in message
news:11**********************@z24g2000prh.googlegr oups.com...
Here is the page architecture:
Page loads multiple user controls (including nested user controls)
dynamically based on parameters provided into place holders. Note: The
page only has the logic to load the user controls and subscribe to
custom event exposed in the user controls.

Scenario:
User comes to this page fills the fields generated by multiple user
controls and then hits "Save" button in one of the forms.

Question:
- How can all the information be collected in the control that has the
save button and saved to a repository?
- Is there a better practise?
- How can all the user controls be "wired" together to cross
communicate?
In the same way that you exposed the events from the user controls, you can
expose properties. Add properties to the user controls which will return the
data they have gathered from their input controls. The controlling page can
read those properties and use them to write to the repository.

I suggest that you do not do what is done by some code I know (you know who
you are!). Do not have a Save method on each user control, that accepts a
DataTable. The user control can fill the DataTable with the information it
has gathered.

The problem is that you have now closely tied each individual user control
to the structure of the data in your repository. It is better to separate
data from presentation. Instead, either have separate properties, or have a
property that returns a Data Transfer Object (DTO) from the user control. It
should return a struct containing all of the data collected by the user
control. Your calling page can take that data and put it into your
repository however it likes. The nice thing is that the user controls will
not need to change if the details of your data access layer change.
--
John Saunders [MVP]

Jul 19 '07 #2

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

Similar topics

1
by: MatthewRoberts | last post by:
Howdy All, I am having difficulty with two-way communication across AppDomains in an attempt to dynamically script applications. Everything works as expected, except when using ByRef parameters....
5
by: George Durzi | last post by:
I have a simple user control with a text box and a submit button. When the user enters some text into the textbox and clicks the submit button, a record is created in the database. I'm using...
6
by: Art | last post by:
Hi I'm new at this and need some help. I have a "solution" with 2 projects - the main project and a library. The library is simple, it contains a text box that will appear many times in the form...
4
by: Jacob JKW | last post by:
Having read the CLJ FAQ and having done extensive Googling, I do understand that in in general cross-domain iframe scripting is not permitted. One issue I have not seen directly addressed, however,...
1
by: NagarajanS | last post by:
hi, i have a problem in cross thread communication.my problem is i drog some controls in the form.now i created new thread inside the coding of form.cs.when i try to run that thread it shows the...
4
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Just wondering if someone can help me out. I'm building a web app that uses UserControls for different forms etc. I have a few UserControls that are embeded and I want to be able to call/pass data...
1
by: zb | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
0
by: zb | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
4
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have am developing a windows app that has a login form. This login form can be called by several classes. When the login form is able to verify that the supplied credentials...
1
by: pankaj17 | last post by:
hello , Cross-Domain Communication Between IFrames in this script they have included 2 iframes. parent can send a message to both iframes and frames can send massage to each other. they have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.