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

How to add data to radgrid column manually

1 Answer 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SHEIKH
Top achievements
Rank 1
SHEIKH asked on 12 May 2011, 04:47 PM
Hi,
I've a radgridview... with 2 columns i.e. question [GridViewDataColumn], answer[GridViewDataColumn having RadComboBox in CellTemplate]. Question column is all set with data from the domain service. Every question can have multiple different answers that is required to be displayed in the form of a dropdown. May be this can be done through Complex entities. but my latest encounter with complex types was too bad. it has their so much limitations, hardly handles simple scenarios. So now I'm looking for a workaround that can let populate data in the answers column in the form of combobox manually from my ViewModel. Or put it in this way, is there a way where I can update the datasource for a column against the a given row from my ViewModel.

is there any way to do it???

thanks in advance.  

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 May 2011, 06:38 AM
Hello Sheikh,

Following is the code that tried to populate one column in gridview manually using MVVM. Hope it might help.

<telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding ItemCollection,Mode=TwoWay}"   >
       <telerik:RadGridView.Columns>
            <telerik:GridViewColumn Header="Facility Name">
                <telerik:GridViewColumn.CellTemplate>
                     <DataTemplate>
                         <ComboBox ItemsSource="{Binding NewCollection, Mode=TwoWay}" >
                             <ComboBox.ItemTemplate>
                                 <DataTemplate >
                                      <Grid>
                                        <TextBlock Text="{Binding Name}" />
                                      </Grid>
                                  </DataTemplate>
                              </ComboBox.ItemTemplate>
                          </ComboBox>
                       </DataTemplate>
                 </telerik:GridViewColumn.CellTemplate>
             </telerik:GridViewColumn>
         </telerik:RadGridView.Columns>
 </telerik:RadGridView>

Thanks,
Princy.
Tags
GridView
Asked by
SHEIKH
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or