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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Accessing current record using OnDraw ''rowIndex''

Thread ID:

Created:

Updated:

Platform:

Replies:

60722 May 10,2007 02:19 PM UTC May 11,2007 11:25 AM UTC WinForms 3
loading
Tags: GridControl
Russell Coombes
Asked On May 10, 2007 02:19 PM UTC

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'!

Thanks,
Russell

Administrator [Syncfusion]
Replied On 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);

Russell Coombes
Replied On 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);

Administrator [Syncfusion]
Replied On 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");
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;