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

Gridview Edit Mode

4 Answers 130 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 04 Mar 2011, 05:45 PM
I'm using permissions on a viewmodel to determine if the user can edit the gridview. If the user can edit the gridview i would like that entire column to be in an "Edit" mode. If not then the only see the cell template. Is there a way to set the gridview in Edit Mode by default? I can change the other columns IsReadOnly to false that I don't need accessed.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 06 Mar 2011, 01:15 AM
Hi Will,

 Only one cell can be in edit mode at a time by default. What you can do is to set the CellTemplate property of the column you wish to be in "edit mode" to a template with the appropriate control (for instance a TextBox bound to the property the column is bound to). That way all the cells in the column will contain a TextBox, which the user will be able to manipulate, without having to toggle the edit mode of RadGridView.

Kind regards,
Yavor Georgiev
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!
0
jay
Top achievements
Rank 1
answered on 02 Dec 2011, 04:20 PM
Could you post an example of the xaml for the above solution?  Here is what I'm using and Not getting the checkbox controls to be in edit mode by default:

<telerik:RadGridView x:Name="MerchantSelectionGrid"
                                 IsFilteringAllowed="True"
                                 SelectionMode="Single"
                                 ShowGroupPanel="False"  
                                 AutoGenerateColumns="False"
                                 ItemsSource="{Binding Merchants}"
                                 VerticalContentAlignment="Stretch"
                                 Grid.Row="1"
                                 BorderThickness="0,1,0,0"
                                 Background="{x:Null}" Grid.Column="1" ShowGroupFooters="True" VerticalAlignment="Top">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="" IsReadOnly="False" DataMemberBinding="{Binding IsSelected, Mode=TwoWay}">
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <CheckBox IsEnabled="True" IsChecked="{Binding IsSelected, Mode=TwoWay}"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Group Name" IsReadOnly="true" DataMemberBinding="{Binding GroupName}"/>
                    <telerik:GridViewDataColumn Header="Family Name" IsReadOnly="true" DataMemberBinding="{Binding FamilyName}"/>
                    <telerik:GridViewDataColumn Header="Category Name" IsReadOnly="true" DataMemberBinding="{Binding CategoryName}"/>
                    <telerik:GridViewDataColumn Header="Merchant Name" IsReadOnly="true" DataMemberBinding="{Binding Name}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
0
jay
Top achievements
Rank 1
answered on 02 Dec 2011, 04:27 PM
Nevermind.  Found the issues.  I was using the CellEditTemplate vs. the CellTemplate.  What's the diff?
0
Dimitrina
Telerik team
answered on 05 Dec 2011, 10:08 AM
Hello Jay,

It is good to hear that you have resolved your problem.

As to what is the difference between the CellTemplate and CelEditTemplate:
  •  The CellTemplate gets or sets the data template for the cell in view mode
  •  The CellEditTemplate gets or sets the data template for the cell in edit mode.

All the best,
Didie
the Telerik team

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

Tags
GridView
Asked by
Will
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
jay
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or