473,396 Members | 1,914 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.

Containment hierarchy in master-detail grids

This post is for the Google crawler-- no response in required.

Can a containment hierarchy made up of two collections derived from
BindingList<T> be data-bound to master-detail dataGridView controls?

Assume a collection, CustomerList, derived from BindingList<T>, with a
property Orders, of type OrderList, also derived from BindingList<T>. Here
is how to create a master-detail pair of grids:

In design mode, create a form with two dataGridView controls, dgvCustomers
and dgvOrders. Add two BindingSource components, bsCustomers, and bsOrders.
Set the DataSource for dgvCustomers to bsCustomers, and set the DataSource
for bsCustomers to the CustomerList object. Set the DataSource for DGVOrders
to bsOrders. Now, here's the trick--set the DataSource for bsOrders to
bsCustomers. Drop down the list for bsOrders' DataMember property, and you
will see "Orders". Select that, and dgvOrders will show the OrderList
properties as columns.

At this point, both grids can be configured and formatted as desired. But
all we've really done is bound the grids to our objects' schema--we still
need to wire up the run time customer list. One line of code will do it.
Assume the CustomerList is contained in a member variable variable
m_Customers:

bsCustomers.DataSource = m_Customers;

Now the two grids will behave as a master-detail pair. As different
customers are selected in dgvCustomers, dgvOrders will update to show those
customers' orders.

Jan 4 '06 #1
0 1864

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

Similar topics

2
by: Chandrashekara Adiga | last post by:
hi This is particular to Containment classes .. ( just taking an example from rougewave ) Can someone point out How destrutor of new RWDate(2, "Nov", 1980) will be called? Is is our...
1
by: Dave | last post by:
Hello all, The methodology of policy-based design states that one should inherit from policy classes and, of course, these classes must provide an agreed-upon public interface and semantics. ...
2
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: ...
1
by: Baski | last post by:
Does anyone knows any article explains effective use of containment and aggregation with interfaces using C#. Thanks Baski
7
by: SpookyET | last post by:
/FooProject /bin (release) /doc /src (only *.cs) /temp (obj files) /test (debug) /build /Visual Studio 2003 /Visual Studio 2005
3
by: Mr Dyl | last post by:
Hello, maybe somebody can enlighten me? :) I wasn't really sure how to concisely describe the following scenario so it was tricky to search for help. Simplifying the problem... I have a home...
2
by: Luke Dalessandro | last post by:
I have an application with the following layout /root/ /root/Default.aspx /root/web.config /root/child/ /root/child/web.config web.config has a custom configuration section "testSection"...
3
by: krzysztof.konopko | last post by:
Hello! I want to design a class hierarchy with one base abstract class, let's say CBase. I have a predicate that every object in the class hierarchy must have a parent object of type from this...
12
by: Daz | last post by:
Hi guys, I'm trying to make a script.aculo.us sortable list have a limited number of elements in it. Now I can check for this really easily and have a warning message, and of course the php...
2
by: Tem | last post by:
I have a table that looks like this. Each row is a reply or a topic when IsAReplyTo = 0 I need to write a query that pulls all rows of a hierarchy of a given ID Table Forum ID IsAReplyTo 4...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.