Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Display name from foreign Key constraint within a combobox

$
0
0

Hi guys,

I have three tables. Employee, ClientEmp and Client.

ClientEmp has the FK of both Employee and Client. 

So far, I am able to save changes to CliemtEmp in my database (using EF) based on the selected Client. But I have to type in the FK ID (emp ID) manually in atextbox to be able to match the data.

Therefore, is there a way to show using a combo box a list of names from the Employee table the saves to the database?

I have tried this, but it doesn't seem to work.

<ComboBox Grid.Column="1" Grid.Row="1" Name="cbEmployeeName" 
                  ItemsSource="{Binding Source={StaticResource Employee}}" 
                  DisplayMemberPath="FirstName" 
                  SelectedValuePath="EmployeeID"></ComboBox>

Any ideas of how I could over come this problem would be much appreciated

Many thanks,

Greg :).


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>