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
close icon

Working with Row Header

I am trying to add an icon to the RowHeader to indicate the row status (added, deleted, unchanged, etc).
A couple of questions:
Form the body of the program (not an event)
1.  Is there a way to access the RowHeader CellInfo for a specific (RowIndex) row or for any cell for that matter?
2.  Is there a way to trigger an DrawCell event for a specific cell or row?
Thanks

3 Replies

JN Jayaleshwari N Syncfusion Team December 19, 2018 11:33 AM UTC

Hi Thomas, 
 
Thanks for contacting Syncfusion Support. Please find the details about the queries. 
 
Query 
Solution 
Is there a way to access the RowHeader CellInfo for a specific (RowIndex) row or for any cell for that matter? 
It is not possible to access the row header cell information for a specific row or cell without using any DrawCell event. You can achieve your requirement to add icon on the row header using the DrawCell event  or by creating custom row header cell renderer. 
 
You can refer the below UG link to customize the row header. 
 
Is there a way to trigger an DrawCell event for a specific cell or row? 
DrawCell event will be raised every time while drawing each cells in the DataGrid. It cannot be triggered for any specific cell or row. You can perform any action while drawing a specific row or cell by using DrawCellEventArgs.RowIndex and DrawCellEventArgs.ColumnIndex properties as given in the following code example. 
 
this.sfDataGrid1.DrawCell += sfDataGrid1_DrawCell; 
 
void sfDataGrid1_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e) 
{ 
    if (e.RowIndex == 1 && e.ColumnIndex == 2) 
    { 
        //Do your customizations here. 
    } 
} 
 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N 



TJ Thomas J Morgan December 25, 2018 04:35 PM UTC

Found out that sfDataGrid.Refresh(); will trigger the DrawCell event.  all set.



SP Shobika Palani Syncfusion Team December 26, 2018 04:14 PM UTC

Hi Thomas, 

Thanks for the update. 

You can use SfDataGrid.Refresh() method to trigger the DrawCell event of datagrid. In that based on DrawCellEventArgs.RowIndex and DrawCellEventArgs.ColumnIndex, you can perform any action for the particular row/cell, as like we mentioned in our previous update.  

Please let us know if you need any further assistance on this. 

Regards, 
Shobika. 


Loader.
Live Chat Icon For mobile
Up arrow icon