The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi, I am using a class that inherits from GridGenericControlCellRenderer. Within the OnDraw method, I am given the 'rowIndex'. When I have only one row in my DataTable datasource, I would expect the rowIndex to be 0 for the first row, but instead it is 1. I assume that it is because the hidden ColumnHeader has rowIndex 0.
So how do I use this rowIndex to obtain the current record? And how can I get the DataRow that the current record will be bound to?
Please note, that I am NOT prepared to accept an answer that includes accessing a row using 'rowIndex - 1'!
ADAdministrator Syncfusion Team May 10, 2007 04:28 PM UTC
If you are using a GridDataBoundGrid as your bound grid, then you can use: int position = gridDataBoundGrid.Binder.RowIndexToPosition(rowIndex);
RCRussell Coombes May 11, 2007 06:30 AM UTC
I am using the GridGroupingControl, so I'm afraid this won't help me.
Do you have the equivalent code that will work with the GridGroupingControl?
Thanks, Russell
>If you are using a GridDataBoundGrid as your bound grid, then you can use: int position = gridDataBoundGrid.Binder.RowIndexToPosition(rowIndex);
ADAdministrator Syncfusion Team May 11, 2007 11:25 AM UTC
In a GridGroupingControl, you can access the underlying record through the style object. GridTableCellStyleInfo tableStyle = style as GridTableCellStyleInfo; Record r = tableStyle.TableCellIdentity.DisplayElement.GetRecord(); if (r != null) { //use code like this to access the field values object o = r.GetValue("SomeFieldName"); }