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

CellTemplate as ComboBox Changes Value in All Rows

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Robert Kaucher
Top achievements
Rank 2
Robert Kaucher asked on 03 Mar 2011, 04:26 PM
I have aRadGridView controm populated by a DOmainDataSource. It populates teh GridView with information about part objects.

 I have another DomainDataSource that is configured as a static resource in XAML and is used to populate a combobox with ForecastOwner objects. These are associated objects of the Part objects.

Part * => 1 ForecastOwner

I have the column celltemplate defined as this:
<telerik:GridViewDataColumn.CellTemplate>
    <DataTemplate>
        <ComboBox
            ItemsSource="{Binding Data, Source={StaticResource forecastOwnerDomainDataSource}, Mode=TwoWay}"
            SelectedValue="{Binding ForecastOwnerID, Mode=TwoWay}"
            SelectedValuePath="ForecastOwnerID"
            DisplayMemberPath="FullName" />
    </DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
The issue I am having is that when I define it as a CellTemplate when I make a selection change it changes the field in every row of the GridView, not just the selected row.

When I define it as CellEditTemplate nothing, no text at all, is displayed until I click in the cell. If I define both a CellTemplate and a CellEditTemplate (say CellTemplate as a TextBox) it over rides the CellEditTemplate. No big deal, I define the CellTemplate as a TextBlock and it works UNTIL I change the selection and then, of course, I have nothing displayed in that cell because the TextBlock is bound to the Part's associated ForecastOwner's FullName Property. So I assume I need some sort of value converter, but I am a little stumped. Thank you in advance for your help.

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Mar 2011, 11:53 AM
Hi Robert,

May you try to use RadComboBox instead of ComboBox? Furthermore, you may benefit from the GridViewComboBoxColumn.
 
 

Regards,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Robert Kaucher
Top achievements
Rank 2
Answers by
Maya
Telerik team
Share this question
or