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

DataFormComboBoxField binding to a list

1 Answer 70 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Balaji
Top achievements
Rank 1
Balaji asked on 01 Sep 2011, 12:49 PM
I have a simple list with two properties namely Status name and StatusId
I tried to bind with the Dataformcomboboxfield in raddataform on control loaded event.
I set the DisplayMemberpath and selectedvalue path but sadly my Combobox is displaying me the Namespace of the Binded class not the actual values.
Following is my Implemented Code
The below code is what i have written in the StatusLoaded event where uxComboBindList is a list populated from database.
StatusName and StatusId are the properties of the class
((Telerik.Windows.Controls.DataFormComboBoxField) sender).ItemsSource = uxComboBindList;
 ((Telerik.Windows.Controls.DataFormComboBoxField)sender).DisplayMemberPath ="StatusName";
((Telerik.Windows.Controls.DataFormComboBoxField) sender). = "StatusId";
<telerik:DataFormComboBoxField Loaded="uxStatus_Loaded" x:Name="uxStatus"  />
On the UI i see the Namespace of the class not the Statusname .
Kindly help.
:)

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 03 Sep 2011, 12:58 PM
Hi Balaji,

The cause of the observed behavior is that you set the Display Member too late.
When the control is loaded , it has already initialized the internal combo box.

I am attaching a project with the recommended way.

Best wishes,
Pavel Pavlov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
ComboBox
Asked by
Balaji
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or