We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CurrentCellValueChangedEvent is fired without value change on columns of type GridTemplateColumn

Hello Syncfusion,

I have a grid with a column of type GridTemplateType like this

<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Code}" VerticalAlignment="Center" />
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>

<syncfusion:GridTemplateColumn.EditTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding Code}" TabIndex="0"/>
<syncfusion:ButtonAdv Grid.Column="1"
SizeMode="Small" 
SmallIcon="/oculus;component/Assets/search-24.png"
Margin="0.5,0,0,0"
TabIndex="1"
Command="{Binding Find}"/>
</Grid>
</DataTemplate>
</syncfusion:GridTemplateColumn.EditTemplate>


The problem is each time you ends editing of a cell, although no changes are made, the CurrentCellValueChangedEvent is triggered.

Thanks.

Miquel Juan


3 Replies

SS Susmitha Sundar Syncfusion Team September 19, 2019 05:23 PM UTC

Hi Miquel, 
 
Thank you for using Syncfusion control. 
 
In GridTemplateColumn, we can load any controls and we can’t find the triggering of the value changing from that controls. So we have raised the CurrentCellvalueChanged event manually from GridTemplateColumn. 
 
You can  restrict this behaviour by overriding the OnEditingComplete() method in GridCellTemplateRender. Please refer the below code snippet. 
C#: 
  this.sfdatagrid.CellRenderers.Remove("Template"); 
  this.sfdatagrid.CellRenderers.Add("Template",new GridCellTemplateRenderExt()); 
 
   public class GridCellTemplateRenderExt : GridCellTemplateRenderer 
 { 
     protected override void OnEditingComplete(DataColumnBase dataColumn, FrameworkElement currentRendererElement) 
     { 
          
     } 
 } 
 
 
Please revert to us back, if you need further assistance. 
 
Regards, 
Susmitha S 



MI Miquel September 23, 2019 08:36 AM UTC

Thank you. Works perfectly!!.


FP Farjana Parveen Ayubb Syncfusion Team September 24, 2019 06:05 AM UTC

Hi Miquel, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon