Home All Groups Group Topic Archive Search About

c# - How to bind a many to one

Author
14 Mar 2006 8:50 AM
Ant
Hi,
I’m displaying Products & their categories on a form. (1 category can have
many products). I want to bind the controls to the Binding context so that I
can use a currency manager to navigate through the rows. Navigation will be
based on the products, not the categories (I want to show the category of
each product).
I have set up an XML relationship between the Products & Categories.

If I’m setting the currency manager to products, to be able to navigate via
products, how do I bind the categories text box to the categories datasource?

I have tried both programmatically:

this.cboCat.DataBindings.Add("Text",dsMaster,"Products"); (also tried
"Categories")

& I’ve tried setting the control at design time:

DataBindings to dsMaster – Categories.CategoryName
then set the DataSource & DataMember properties of the control.

I can see why this wouldn’t work as it needs to share the same
DataSource/member as the Binding Context, but how do I do this?

Any suggestions would be most appreciated
Ant

AddThis Social Bookmark Button