This is a migrated thread and some comments may be shown as answers.

Displaying the foreign key value in grid (ComboBoxEditor)

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 05 Dec 2008, 01:35 PM
I'd like to display the foreign key value rather than the ID in the combobox editors.  I found this example (http://www.telerik.com/community/forums/wpf/gridview/how-to-display-the-foreign-key-value-in-grid.aspx), however with the new Q3 release this approach no longer works.

Is there an new approach for handling this now?

Thanks,
  Christopher

1 Answer, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 05 Dec 2008, 05:13 PM
Hi Christopher,

I'm attaching a modified version of the example that you already have, which works fine with the Q3 assemblies.
The problem comes from a small change we made to the DataContext of the GridViewRow object. Now the DataContext property is the business object itself.

Therefore there is a small change in binding of the Content property from
Content="{Binding Data.PersonType.Name}" to
Content="{Binding PersonType.Name}" 
.
Also there is a change in CustomComboBoxEditor.cs file where getting the personType object becomes
PersonType personType = ((Person) this.DataContext).PersonType; 


Sorry for the inconvenience caused.

Best wishes,
Nedyalko Nikolov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or