Databindings and Relationships
From: Oliver Lundt via .NET 247 (anonymous_at_dotnet247.com)
Date: 12/23/04
- Previous message: Tim Bain via .NET 247: "Databinding to DataRow Properties"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Dec 2004 16:04:45 -0800
I have a combobox bound to a table with a relationship. When the combobox selection changes the I change the values displayed. It works fine but only on the field in the same table. It relationship doesn't allow me to display values from the other table. Here my code:
//Add Relationships
DataRelation horseLocation = new DataRelation("HorseLocation",dsMain.Tables["tblLocation"].Columns["LocationId"],dsMain.Tables["tblHorseInfo"].Columns["LocationId"]);
dsMain.Relations.Add(horseLocation);
//fill combo box and values
lstHorses.DataSource = dsMain.Tables["tblHorseInfo"];
lstHorses.ValueMember = "HorseId";
lstHorses.DisplayMember = "HorseName";
lblOwner.DataBindings.Add("Text",dsMain.Tables["tblHorseInfo"].DefaultView,"OwnerName");
lblLocation.DataBindings.Add("Text",dsMain.Tables["tblHorseInfo"],"HorseLocation.tblHorseInfo.LocationName");
lblLocation is the databinding that is not working!!
I have the RelationshipName.TableName.TableField
Any ideas???
Thanks
--------------------------------
From: Oliver Lundt
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>oIuEhoLsXEqhlgvZMFjLFA==</Id>
- Previous message: Tim Bain via .NET 247: "Databinding to DataRow Properties"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|