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

DataFormComboBoxField loses the selected value in edit mode

9 Answers 154 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Matteo Gugliotta
Top achievements
Rank 1
Matteo Gugliotta asked on 20 Apr 2012, 07:40 AM
Hi, 
I have a problem with a DataFormComboBoxField generated in code behind as suggested by your example

Here is the code for generate the field
e.DataField = GetComboField(columnFieldProp, e.DataField.DataMemberBinding);
e.DataField.Loaded += delegate(object o, RoutedEventArgs eventArgs)
{
      var field = o as DataFormComboBoxField;
      foreach (RadComboBox child in field.ChildrenOfType<RadComboBox>())
       {
            var comboBox = child;
            if (comboBox != null)
           comboBox.SetBinding(RadComboBox.SelectedValueProperty, e.DataField.DataMemberBinding);
       }
};



private DataFormComboBoxField GetComboField(ToolColumnFieldProp columnFieldProp, Binding dataBinding)
        {
            DataFormComboBoxField combo = new DataFormComboBoxField();
            combo.SelectedValuePath = columnFieldProp.ComboBoxSelectedPath;
            combo.DisplayMemberPath = columnFieldProp.ComboBoxDisplayPath;           
            object context = Code.Utility.CreateInstance(columnFieldProp.ComboBoxAssemblyName, columnFieldProp.ComboBoxContextNameSpace);
            combo.ItemsSource = Code.Utility.GetComboBoxItemSource(context);          
            combo.DataMemberBinding = dataBinding;          
            return combo;
        }

XAML
<telerik:RadDataForm x:Name="rdDataForm"  Header="{Binding Title}" CurrentItem="{Binding Current, Mode=TwoWay}" telerik:StyleManager.Theme="Office_Blue"
                    ItemsSource="{Binding List, Mode=TwoWay}" AutoGeneratingField="rdDataForm_AutoGeneratingField"   Grid.Row="0" AutoCommit="False"
                      EditEnded="rdDataForm_EditEnded" DeletedItem="rdDataForm_DeletedItem"  CommandButtonsVisibility="Cancel,Commit" LabelPosition="Beside"
                     >
     
</telerik:RadDataForm>

The ComboBoxField is correctly generated, and correctly bound to selected value. 
The problem is that when i go in edit mode, the combobox loses the selected value.

I have the same identical problem in the GridView that is bound to same collection.

Could you please help me?

Best regards

9 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Apr 2012, 09:41 AM
Hello Matteo,

I have tried to reproduce the issue, but since I do not have all the necessary code, I was not able to get close to the scenario you described. Will it be possible to share a bit more code-snippets so that I could test it on my side ?
On the other hand, why do you need to work with the RadComboBox inside DataFormComboBoxField ? Why not using directly the field ?  

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matteo Gugliotta
Top achievements
Rank 1
answered on 20 Apr 2012, 10:02 AM
Hi Maya,

I can try to send you maybe via e-mail a little project, but it is part of a big and complicated project. Anyway if you need i will try to reproduce it.

Anyway, i'm not using rad combobox, but i have just created a DataFormComboBoxField  
0
Maya
Telerik team
answered on 20 Apr 2012, 10:16 AM
Hello Matteo,

I am attaching a sample project here with a RadDataForm and a DataFormComboBoxField. Could you reproduce the same behavior on it by implementing your own custom code ?  

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matteo Gugliotta
Top achievements
Rank 1
answered on 20 Apr 2012, 12:03 PM
HI Maya,

I have downloaded your project and i see that you are using the property dataField.IsComboboxEditable = true;

However, i do not have this property available in my version of silverlight control RadControls for Silverlight, v.2012.1.326.1050
your version is 1.4....

I am not able to download from your site this internal build.

Where i can find the download link?
(i do no want to use automatically upgrade from inside vs2010)

best regards
0
Maya
Telerik team
answered on 20 Apr 2012, 12:42 PM
Hi Matteo,

Indeed, we have included such a property in order to meet our customers' feature requests. 'IsComboboxEditable' property in contained in our internal builds. You can download them in your Telerik account.


Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matteo Gugliotta
Top achievements
Rank 1
answered on 20 Apr 2012, 02:00 PM
Hi Maya,

Thanks, it does not solve my issue but anyway upgrade controls to last version :-)

I will try to create a test project and then back to you
0
kannan
Top achievements
Rank 1
answered on 02 Oct 2014, 03:37 PM
I am facing the same issue, Could some one help me, I have grid view & data form where I have set auto generate columns as false for the data form and grid has auto generate columns true.

In read only mode, it is working fine, but when I switch to edit mode, the dataform combobox having the item source bound but loses it selected value. then when I go to next record in the grid, the previous record loses it's value associated to the dataform combobox.

​
0
Boris
Telerik team
answered on 06 Oct 2014, 03:24 PM
Hello Kannan,

I tried to reproduce a similar behavior as in your description, however I was unsuccessful. Could you please examine the attached example and let us know how it goes? Perhaps there are some differences between the attached sample and your scenario. 

Regards,
Boris Penev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
kannan
Top achievements
Rank 1
answered on 07 Oct 2014, 08:50 PM
Thank you Penev,

But I have gone through and do not see I am missing anything.however I fixed it by adding a combobox inside the dataformdatafield which worked!!!

Thanks
kannan M
Tags
DataForm
Asked by
Matteo Gugliotta
Top achievements
Rank 1
Answers by
Maya
Telerik team
Matteo Gugliotta
Top achievements
Rank 1
kannan
Top achievements
Rank 1
Boris
Telerik team
Share this question
or