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

Get DataFormComboBoxField selected item?

3 Answers 161 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Austin
Top achievements
Rank 1
Austin asked on 24 Aug 2011, 02:06 AM
Is there a way to get a DataFormComboBoxFields currently selected item?

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 24 Aug 2011, 09:28 AM
Hello Austin,

The currently selected item in a regular case should be reflected in the bound property of your business object.
For example if you have a combo field for choosing countries e.g. bound to the CountryID property of your business object ( DataMemberBinding = {Binding CountryID} ), then you can read the property( CountryID) itself.

In case you have more complicated scenario , please give some more details so we can think of some solution . 

All the best,
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 >>

0
Austin
Top achievements
Rank 1
answered on 24 Aug 2011, 09:47 PM
This certainly helped me, but I have another related issue.

If I take the DataMemberBinding value (In your example CountryID, which is also the DataFormComboBoxField's SelectedValuePath) and change it, I expect to see the ComboBox change it's selection. This is what occurs when I edit the bound value through the DataForm, and all is good - but if I manually change the CountryID value through the code behind, I see no changes in the DataForm on either the ComboBox or the CountryID field. Naively I attempted to DataForm.UpdateLayout, but I'm obviously missing something here, as no matter what I seem to do in the code behind I can't get the DataForm to recognize the new CountryID value.

Any suggestions?

Edit: I've corrected this issue myself through INotifyPropertyChanged
0
Pavel Pavlov
Telerik team
answered on 25 Aug 2011, 01:05 PM
Hello Austin,

Glad to know you have solved the issues.Yes  , indeed  the INotifyPropertyChanged is the recommended way.

All the best,
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
DataForm
Asked by
Austin
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Austin
Top achievements
Rank 1
Share this question
or