Skip to main content

ColumnView.LocateByValue(String, Object, OperationCompleted[]) Method

Locates rows by cell values.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public int LocateByValue(
    string fieldName,
    object val,
    params OperationCompleted[] completed


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.


Type Description

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.


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.


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;
See Also