ColumnView.LocateByValue(String, Object, OperationCompleted[]) Method
Locates rows by cell values.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
#Declaration
public int LocateByValue(
string fieldName,
object val,
params OperationCompleted[] completed
)
#Parameters
Name | Type | Description |
---|---|---|
field |
String | A string that specifies the target column’s field name. |
val | Object | An object that is the value to search for. |
completed | DevExpress. |
A DevExpress. |
#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. The Grid |
#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.