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

Combobox does not show value when leaving CellEditTemplate

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Licenses
Top achievements
Rank 1
Licenses asked on 15 Dec 2010, 12:00 PM
Hello,

We have a usercontrol that has a radgridview. On one of the columns we set a celledittemplate:
<DataTemplate x:Key="OptionDetailCellEditTemplate">
  
<telerik:RadComboBox ItemsSource="{Binding ViewModel.OptionDetailList, Source={StaticResource VMC}}" DisplayMemberPath="Description" SelectedValuePath="Id" SelectedValue="{Binding ContactOptionDetailId, Mode=TwoWay}" />
  
</DataTemplate>

The column:
<telerikGrid:GridViewDataColumn DataMemberBinding="{Binding OptionDetail.Description, Mode=TwoWay}" CellEditTemplate="{StaticResource OptionDetailCellEditTemplate}"/>

When I add a new row to the grid. The grid is now in edit mode and the combobox is shown. I change the selected item in the combobox. If I TAB to the next cell, the first cell leaves the edit template, but the OptionDetail.Description is not shown. When I save and open this usercontrol again, all values have been correctly saved and the description is now visible.
If, instead of a TAB to the next cell, I click another existing row after choosing a value from the combobox, the OptionDetail.Description is correctly shown.
When editing existing items, the description is correctly shown after TABing out of the combobox cell.

To clarify further: We use RIA Services. The itemssource of the grid is set to an ObservableCollection of Contact Entities. A Contact Entity has an RIA association with an OptionDetail entity. The Contacts and the OptionDetails are loaded via separate queries in the same context. That is why the DataMemberBinding to OptionDetail.Description works (RIA couples related entities loaded in the same context automatically). In the celledittemplate, we bind directly to the ViewModel property OptionDetailList that contains all possible OptionDetails for a Contact.

We realise this could also be achieved with a RadGridViewComboBoxColumn, but this doesn't seem to work well with the Contacts and OptionDetails being loaded in different queries. Researching the forums has lead us to this workaround.

Thank You,
Sodi We

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Dec 2010, 03:55 PM
Hello Sodi We,

Using the code-snippet you provided, I have tried to reproduce the issue you specified. Unfortunately, I was not able to. I am sending you the sample project I used  for testing it. Please take a look at it and let me know in case of any discrepancies according to your requirements.

Greetings,

Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Licenses
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or