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

How to show rownumber on GridTemplateColumn?

Hi, i have seen an example on how to show the rownumber using Text="{Binding RowIndex, RelativeSource={RelativeSource TemplatedParent}}" on "syncfusion:GridRowHeaderCell" style, but i can not replicate this with a GridTemplateColumn.

Please could you tell me how to show the rownumber in a GridTemplateColumn??

Thanks in advance.

1 Reply

DB Dinesh Babu Yadav Syncfusion Team May 16, 2019 11:26 AM UTC

Hi Eduardo, 
Thanks for using Syncfusion products. 
If you want to display the row index in the GridTemplateColumn, you can use the following Binding to get the RowIndex property of ColumnBase from the ancestor of the GridCell.  
Refer to the following code snippet, 
Code Snippet: 
<syncfusion:GridTemplateColumn MappingName="Name"> 
            <TextBlock Text="{Binding Path=ColumnBase.RowIndex,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=syncfusion:GridCell}}" />                                     
Dinesh Babu Yadav 

Live Chat Icon For mobile
Up arrow icon