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

How to disable radgridview command button (commitedit/cancelrowedit) in other row other than current edited row.

1 Answer 265 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ray
Top achievements
Rank 1
ray asked on 17 Mar 2014, 07:30 AM
Hello, 

Yes, the title is my main concern. Its maybe a bit confusing but take a look at the image. The first image shows that the commitedit and cancelrowedit is disabled as i didnt edit any row yet. The second image shows that all of the button on each of the row is enabled after i select the first row to be edited. 

I am trying to set the other button to be disabled except for the button on current row. is there any way to do that? Here are my xaml code for the action column. Thank you so much for your help.

<telerik:GridViewColumn Header="Action">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                
                                <Button Grid.Row="0" x:Name="deleteColumn" 
                                    Height="35"
                                    HorizontalAlignment="Center"
                                    Command="telerikGrid:RadGridViewCommands.Delete"
                                    CommandParameter="{Binding}">
                                    <Button.Content>
                                        <Image Source="Images/delete.ico"/>
                                    </Button.Content>
                                </Button>
                                
                                <Button Grid.Row="0" x:Name="saveColumn"
                                        Height="35"
                                        HorizontalAlignment="Center"
                                        Command="telerikGrid:RadGridViewCommands.CommitEdit"
                                        CommandParameter="{Binding}">
                                    <Button.Content>
                                        <Image Source="Images/saveInsert.ico"/>
                                    </Button.Content>
                                </Button>

                                <Button Grid.Row="0" x:Name="cancelColumn"
                                        Height="35"
                                        HorizontalAlignment="Center"
                                        Command="telerikGrid:RadGridViewCommands.CancelRowEdit"
                                        CommandParameter="{Binding}">
                                    <Button.Content>
                                        <Image Source="Images/undo.ico"/>
                                    </Button.Content>
                                </Button>
                                
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>



1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 19 Mar 2014, 04:16 PM
Hi Ray,

You can achieve the desired behavior by creating a boolean property which can be bound to the IsEnabled property of the button. You can change the value of the created property during an event like BeginningEdit or SelectionChanged

Please see the attached sample project for an example of this approach.

Regards,
Hristo
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
GridView
Asked by
ray
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or