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

Not able to invoke RowEditEnded or CellEditEnded eventhandler from celltemplate type column of radgridview

1 Answer 228 Views
GridView
This is a migrated thread and some comments may be shown as answers.
rajeev kumar
Top achievements
Rank 1
rajeev kumar asked on 29 Oct 2009, 12:31 PM
I have used radgridview with celltemplate for column. I am not able to call  RowEditEnded or  CellEditEnded eventhandler on click of cell to edit the cell value. If I removed celltemplate used for binding, then it is working fine and corresponding celledittemplate is displaying and RowEditEnded or  CellEditEnded event handler is also invoking.But, if I am putting both inside GridViewDataColumn tag, it is not working. I am putting my code below for reference.



  <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=FirstName}">
                 <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox BorderThickness="0" Text= "{Binding FirstName}" Foreground="#0066cc"   Width="100" TextAlignment="Center" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                    <telerik:GridViewColumn.CellEditTemplate>
                        <DataTemplate>
                            <TextBox BorderThickness="0" Text= "{Binding FirstName,Mode=TwoWay}" Foreground="#0066cc"   Width="100" TextAlignment="Center" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>

Please help me in that. I just want to call RowEditEnded or  CellEditEnded  method on click of cell for editing purpose. But that cell using celltemplate. It is very very urgent.

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 03 Nov 2009, 08:52 AM
Hi rajeev kumar,

Generally both templates CellEditTemplate and CellTemplate are for editing. The reason that EditEnded events are not raised is that cell never enters into edit mode. Below is a modified version of your code, which will work fine.

<telerik:GridViewDataColumn UniqueName="FirstName" TextAlignment="Center" DataMemberBinding="{Binding FirstName}">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding FirstName}" Background="LightGreen" Foreground="#0066cc" Width="100" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                    <telerik:GridViewColumn.CellEditTemplate>
                        <DataTemplate>
                            <TextBox BorderThickness="0" Text="{Binding FirstName,Mode=TwoWay}" Foreground="#0066cc" Width="100" TextAlignment="Center" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>


P.S. In order to raise RowEditEnded event with 2009.2.813 you should set radGridView.ValidationMode = ValidationMode.Row. There are some improvements regarding editing events with the latest internal build assemblies. One of these improvements is that RowEditEnded event is always raised no matter of the ValidationMode property value. By the way ValidationMode property will be obsolete with 2009.Q3 release.

Regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
rajeev kumar
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or