Finding a row in GDBG

Hi How can i find a row in the GDBG for a specified criteria. Thanks Tom

1 Reply

AD Administrator Syncfusion Team December 10, 2005 12:34 AM UTC

The most effiecient way is to directly access the DataSource. Here is some code that assumes you are using a DataTable as the DataSource. If you are using an IList, replace the DataRowView in the code below with the class type of the objects in your list.
CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.Datamember] as CurrencyManager;
int rowIndex = -1;
for(int position = 0; position < cm.List.Count; ++position)
{
	DataRowView drv = cm.List[position] as DataRowView;
	if(drv["Col1''].Equals(25))
	{
		rowIndex = grid.Binder.PositionToRowIndex(position);
		break;
	}
}
//rowindex is the grid row index where Col1 has 25 in it.

Loader.
Up arrow icon