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.

Row/Col index of a DataRowView from a DataRow ?

Thread ID:

Created:

Updated:

Platform:

Replies:

19752 Oct 3,2004 10:30 PM Oct 5,2004 04:07 PM Windows Forms 4
loading
Tags: Grouping
David Llewellyn
Asked On October 3, 2004 10:30 PM

Hello, I have created a find function for a grid grouping control table. I am able to search the datatable and ‘find’ the correct datarow. I then want to set that cell to the current cell, in the datarow by using :- this.gridgroupcontrol.TableControl.CurrentCell.MoveTo(rownum,colnum); I realise I can get the column number by using:- int colnum = this. gridgroupcontrol.TableDescriptor.VisibleColumns.IndexOf("Column1"); But how do I find out the row index of the displayed rows, from a known datarow? Thanks, David

Administrator [Syncfusion]
Replied On October 4, 2004 08:30 AM

David, Given the row index of the DataRow you can do the following: Record r = Table.UnsortedRecord[dataRowIndex]; int gridRowIndex = Table.DisplayElements.IndexOf(r); Stefan

David Llewellyn
Replied On October 4, 2004 05:41 PM

Hello Stefan, This doesnt seem to work for me. Both Record r = this.gridgroupcontrol.Table.UnsortedRecords[rowindex]; and Record r = this.gridgroupcontrol.Table.Records[rowindex]; return the same record. But the record returned is not the correct one. Obviously the row index is incorrect. What I am doing is searching the underlying datasource for a certain string, which gives me an index. I then want to be able to convert the underlying data source index into a row index for the visible rows. Is there anyway to do this conversion directly without doing further searches for the unsorted table''s row index ?? Thanks, David

Administrator [Syncfusion]
Replied On October 5, 2004 02:29 AM

Here is a try at doing what I think you are describing. It finds a string in the underlying datatable, and then uses the code that Stefan suggested to find the corresponding grid row. It then uses PrepareViewStyleInfo to color the found row. (The grid row count takes into account things like DropArea and Caption and Headers and AddNewRow so the first row from teh datatsource has index 4.) GGCDataTableSearch_8922.zip

David Llewellyn
Replied On October 5, 2004 04:07 PM

Hello Clay, Thanks for the example. That is exactly what I needed. Cheers. David.

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.

;