How do I get the data bound Item for a row or cell?

I am looking for the Syncfusion equivalent of .NET's gridControl.Rows[e.RowIndex].DataBoundItem;

I have a System.Collections.Generic.List which I bound to a Syncfusion GridDataBoundGrid control.

I need to do some custom formatting in the DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e) method.

How do I get the object from my list for the current row when handling the DrawCellDisplayText event?

1 Reply

AS Athiram S Syncfusion Team January 28, 2013 12:21 PM UTC

Hi Jay,

Thanks for your interest in Syncfusion Products.

You can make use of the following code for accessing the cell text in "DrawCellDisplayText" event.

Here is the code:

void gridDataBoundGrid1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e)
        {
            if (e.RowIndex == 1 && e.ColIndex == 1)
                Console.WriteLine(e.DisplayText);
        }

Here you could get the content for cell[1,1]. Similarly, you can get the text for desired cells.

Please let me know if you have any concerns.

Regards,
Athiram S

Loader.
Up arrow icon