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

Nullable ComboxColumn issue

3 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Infologic
Top achievements
Rank 1
Infologic asked on 28 Sep 2011, 01:51 PM
Hi there,

I need to set a Dictionnary as ItemSource (with DisplayMemberPath et SelectedValueMemberPath setted as done with the regular RadComboBox), but the RadCombox.SelectedValue is never commited to the DataItem. Is that a bug ?

thanks, greg

Edit : Further investigations have shown that the value is commited when the Radcombobox editor looses focus and disapears. FurtherMore, the commited value is the one that was selected one selection step. It means that if i start with a random value and then I select one item in the grid combobox hoping for changing its value, the committed value is the one that was selected at first. If I try to change the selected Item three times in a row without living the editor, the commited value is the second one and not the third as expected.

I am missing something about GridViewComboBoxColumn ?
How could I force the value to be commited for each selection ?

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 29 Sep 2011, 03:35 PM
Hi Saint-Ellier,

You can subscribe to the SelectionChanged event of the RadComboBox and commit the edit on a selection. For example:

this.AddHandler(RadComboBox.SelectionChangedEvent, new Telerik.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged));
          
  
        private void OnSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (e.RemovedItems.Count > 0)
            {
                this.playersGrid.CommitEdit();
            }
        }

Thus once you select an item from the drop down of GridViewComboBoxColumn, this value will be committed.
 

Kind regards,
Maya
the Telerik team

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

0
Infologic
Top achievements
Rank 1
answered on 30 Sep 2011, 10:55 AM
Thanks for your answer,

I used the code below instead of the one suggested.
private void box_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var box = sender as RadComboBox;
             
            box.ParentOfType<RadGridView>().CommitEdit();
             
        }

The association seems to work but the problem persists as I get through this code twice.
It seems that I have unexpected intereactions between a form representing the same dataItem as the one selected in the grid. I am going to investigate further.

Thanks for your answer.

  Greg
0
Maya
Telerik team
answered on 30 Sep 2011, 03:17 PM
Hello Saint-Ellier,

Would you try to add the check whether there are any items removed (as illustrated in the code-snippet I posted above) ? Do you get the same behavior ?
 

Best wishes,
Maya
the Telerik team

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

Tags
GridView
Asked by
Infologic
Top achievements
Rank 1
Answers by
Maya
Telerik team
Infologic
Top achievements
Rank 1
Share this question
or