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.
Unfortunately, activation email could not send to your email. Please try again.

how to get the underlying record for a given row in GGC?

Thread ID:

Created:

Updated:

Platform:

Replies:

54993 Jan 22,2007 09:49 AM Jan 23,2007 05:21 PM Windows Forms 8
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 22, 2007 09:49 AM

Hi,
I'm using gridGroupingControl to bind to a custom IList collection, and I'm displaying grouping info on the grid (group heads and footers). My question is given a row index on the grid, say row 5, how do i get the underlying record this row is bound to?
Thanks,
Frank

Administrator [Syncfusion]
Replied On January 22, 2007 10:55 AM

Hi Frank,

Here is a code snippet that shows how to access a record from a table given the rowindex of it.

// using the displayelements property of the grid, we can find the corresponding record.
Record r = gridGroupingControl1.Table.DisplayElements[rowindex].ParentRecord;

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 22, 2007 12:50 PM

It works great. Thanks a lot.

>Hi Frank,

Here is a code snippet that shows how to access a record from a table given the rowindex of it.

// using the displayelements property of the grid, we can find the corresponding record.
Record r = gridGroupingControl1.Table.DisplayElements[rowindex].ParentRecord;

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 11:51 AM

Now how do I do the reverse? I want to be able to find out the rowindex on the grid, given either the underlying record or the record's index on the datatable?
Thanks,
Frank

>It works great. Thanks a lot.

>Hi Frank,

Here is a code snippet that shows how to access a record from a table given the rowindex of it.

// using the displayelements property of the grid, we can find the corresponding record.
Record r = gridGroupingControl1.Table.DisplayElements[rowindex].ParentRecord;

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 12:12 PM

Hi Frank,

Here is a code snippet that shows how to get the rowindex if the record is given.

int position = gridGroupingControl1.Table.DisplayElements.IndexOf(record);

Refer the Essential Grid Evalution center for more details.
http://www.syncfusion.com/support/evalcenter/default.aspx?cNode=5

Thanks,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 02:48 PM

Hi Haneef,

Thanks for your quick reply. Actually I don't have the record; i only have the index of the record in my datasource. How can I get the rowindex based on the record index?
Thanks,

Frank

>Hi Frank,

Here is a code snippet that shows how to get the rowindex if the record is given.

int position = gridGroupingControl1.Table.DisplayElements.IndexOf(record);

Refer the Essential Grid Evalution center for more details.
http://www.syncfusion.com/support/evalcenter/default.aspx?cNode=5

Thanks,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 02:52 PM

Hi Frank,

Please try this code snippet.

Record record = gridGroupingControl1.Table.Records[RecordIndex];
int RowIndex = gridGroupingControl1.Table.DisplayElements.IndexOf(record);

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 04:14 PM

Hi Haneef,

The RecordIndex is not necessarily the index of the datarow in datatable once grouping is performed. In such case, the records on the grid will be sorted to accommodate the grouping, yet the order of the underlying datarows in the datatable remains the same. My problem is that I have the index of a datarow and I need to know which row on the grid shows that datarow.

Thanks very much,

Frank

>Hi Frank,

Please try this code snippet.

Record record = gridGroupingControl1.Table.Records[RecordIndex];
int RowIndex = gridGroupingControl1.Table.DisplayElements.IndexOf(record);

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 05:21 PM

ah, i found it. it is

gridGroupingControl1.Table.UnsortedRecords[i]

Thanks very much for your help,

Frank

>Hi Haneef,

The RecordIndex is not necessarily the index of the datarow in datatable once grouping is performed. In such case, the records on the grid will be sorted to accommodate the grouping, yet the order of the underlying datarows in the datatable remains the same. My problem is that I have the index of a datarow and I need to know which row on the grid shows that datarow.

Thanks very much,

Frank

>Hi Frank,

Please try this code snippet.

Record record = gridGroupingControl1.Table.Records[RecordIndex];
int RowIndex = gridGroupingControl1.Table.DisplayElements.IndexOf(record);

Best Regards,
Haneef

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.

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.

;