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.

Finding a row in GDBG

Thread ID:

Created:

Updated:

Platform:

Replies:

38346 Dec 9,2005 05:20 PM Dec 9,2005 07:34 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 9, 2005 05:20 PM

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

Administrator [Syncfusion]
Replied On December 9, 2005 07:34 PM

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.

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.

;