473,387 Members | 1,678 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.

Is There a Simpler Way To Display Parent/Child Data in Two ComboBox Controls

..NET 3.5, Windows Forms app: My objective is to display parent/child data in
two ComboBox controls, such that when a parent item is selected in one combo
box, associated child items appear in the other combo box.

I already know one way to make this work using two DataTables and a
DataView, and handling the SelectionChangeCommitted event of the parent
ComboBox so that it sets the .RowFilter of the DataView to which the child
ComboBox is bound.

But what I am wondering is if there is a simpler way to get the job done
using a DataSet with the two DataTables and a DataRelation to set up the
parent/child relationship. I have set up a DataSet as described, but the
child ComboBox (which is bound to the child DataTable in the
DataSet)displays *all* rows from the child DataTable, completely ignoring
the DataRelation, when I am wanting for it to display only the child rows
related to the currently selected parent DataRow.

Am I just missing something, or do I really need to go with the DataView
approach?

Thanks!
Nov 16 '07 #1
1 3546
Bob,

You don't need to do any of the filtering at all. If you have the
DataRelation set up between the two tables, then you can bind the child
combo box to the data relation, and on change of the parent, the child list
will show only the items related to the parent.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bob Johnson" <A@B.comwrote in message
news:em**************@TK2MSFTNGP05.phx.gbl...
.NET 3.5, Windows Forms app: My objective is to display parent/child data
in two ComboBox controls, such that when a parent item is selected in one
combo box, associated child items appear in the other combo box.

I already know one way to make this work using two DataTables and a
DataView, and handling the SelectionChangeCommitted event of the parent
ComboBox so that it sets the .RowFilter of the DataView to which the child
ComboBox is bound.

But what I am wondering is if there is a simpler way to get the job done
using a DataSet with the two DataTables and a DataRelation to set up the
parent/child relationship. I have set up a DataSet as described, but the
child ComboBox (which is bound to the child DataTable in the
DataSet)displays *all* rows from the child DataTable, completely ignoring
the DataRelation, when I am wanting for it to display only the child rows
related to the currently selected parent DataRow.

Am I just missing something, or do I really need to go with the DataView
approach?

Thanks!
Nov 16 '07 #2

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

Similar topics

1
by: Joe D | last post by:
I think this is a simple question. But I am new to JS. Here is what I want to do: From a parent window, open a popup window (child) to get data from user, then user submit the request, close the...
17
by: perryche | last post by:
I have 5records, e.g. Rc1, Rc2, Rc3..., when user open up a form, I want it to open to a particular record (say Rc3) then when user chooses the Record Selector , it will go to Rc2 and , it will go...
2
by: meh | last post by:
I'm not sure if I have the right concept going. I am making a custom TabPage and executing it from a button click event. It works fine I'm just thinking I might be missing the finer points of the...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: dbuchanan | last post by:
Hello, Windows forms & database What are the considerations when choosing how to display reference information from the calling form? What is recommended? Table1 is the parent of Table2. ...
0
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
4
by: Richard Lewis Haggard | last post by:
What is the mechanism by which a child window can notify its parent that it has been clicked on? -- Richard Lewis Haggard www.Haggard-And-Associates.com
1
by: honey99 | last post by:
Hi! i have a same combobox in parent window and child window.If i enter a value in combobox in child window it should automaticall update in parent window without refreshing the parent window page.I...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.