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

[Solved] GridViewComboBoxColumn Bind to Object rather than Id

2 Answers 221 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Heather
Top achievements
Rank 1
Heather asked on 03 Nov 2009, 07:22 PM
I must be missing something easy here....how do I make my combobox bind to a class object rather than an id?   Ex:  I have a person object with a State property which points to a State object.  I set my combobox itemssource to an ObservableCollection(of State).  I want to bind to the Person.State property and have it update accordingly (more like what the Silverlight Combobox does).

The following does not work.  If I click on the list it shows my list of states but the combo does not populate with the selected state (the ItemsSource is set in codebehind in the DataLoading event since all my data comes from a WCF service). 

 

<telerikGridView:GridViewComboBoxColumn HeaderText="State" DataMemberBinding="{Binding Path=State, Mode=TwoWay}" DisplayMemberPath="StateName" />

v2009.2.925.1030,

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 06 Nov 2009, 09:46 AM
Hello Heather,

I have attached a project demonstrating the desired behavior.

In case you have troubles adapting this to your needs let me know.

Best wishes,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Heather
Top achievements
Rank 1
answered on 06 Nov 2009, 12:31 PM
OK - I had omitted setting the SelectedValueMemberPath entirely and that did not work.  Setting it to an empty string seemed to do the trick.  Thank you.
Tags
GridView
Asked by
Heather
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Heather
Top achievements
Rank 1
Share this question
or