ColumnView.LocateByValue(String, Object, OperationCompleted[]) Method
Locates rows by cell values.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
public int LocateByValue(
string fieldName,
object val,
params OperationCompleted[] completed
)
Parameters
Name | Type | Description |
---|---|---|
fieldName | String | A string that specifies the target column’s field name. |
val | Object | An object that is the value to search for. |
completed | DevExpress.Data.OperationCompleted[] | A DevExpress.Data.OperationCompleted method that will be called when the requested operation is completed. The method’s argument will contain the requested value. This parameter is optional and is only required in Instant Feedback Mode. |
Returns
Type | Description |
---|---|
Int32 | If the specified value is loaded, the method returns an integer value specifying the handle of the row found. In Instant Feedback Mode, the DevExpress.Data.DataController.OperationInProgress value is returned if the requested search value is not currently loaded. The GridControl.InvalidRowHandle value, if no row is found that matches the specified condition. |
Remarks
The LocateByValue method performs a search from the top row. The method calls another LocateByValue overload with four parameters. See its description, to learn more about data searching.
Example
This example shows how to use the LocateByValue method to search for a row in Instant Feedback Mode mode.
using DevExpress.XtraGrid.Views.Grid;
private void locateRowButton_Click(object sender, EventArgs e) {
int rowHandle = gridView1.LocateByValue("Oid", 53498, OnRowSearchComplete);
if (rowHandle != DevExpress.Data.DataController.OperationInProgress)
FocusRow(gridView1, rowHandle);
}
void OnRowSearchComplete(object rh) {
int rowHandle = (int)rh;
if (gridView1.IsValidRowHandle(rowHandle))
FocusRow(gridView1, rowHandle);
}
public void FocusRow(GridView view, int rowHandle) {
view.FocusedRowHandle = rowHandle;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LocateByValue(String, Object, OperationCompleted[]) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.