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. Image for the cookie policy date

Search value in column and select row

Hello,

I hope you can help me - I have not found a solution.
In a grid grouping control I have bound my database. Is it possible to search in a column (for example the ID) a value and when I found it show the position and select the whole row?

The reason is, when i make a doubleclick on a row a second windows opens to make changes. When I click save the windows close and the GGC is reloading (more user work on the database) the data from the database. The GGC shows the list on the top but user would like to see the last edited row.

Thanks for your support.
Thomas

1 Reply

MG Mohanraj Gunasekaran Syncfusion Team November 26, 2018 01:11 PM UTC

Hi Thomas, 
 
Thanks for using Syncfusion product. 
 
To find the cell value based on the column name, you could use the Record row index using GetRowIndex method and select that record using SetSelected method in QueryCellStyleInfo event. Please refer the following code example, 
 
Code example 
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
 
int rowIndex = -1; 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null) 
        return; 
             
    if (e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) 
    { 
        var record = e.TableCellIdentity.DisplayElement.GetRecord(); 
        if (e.TableCellIdentity.Column.Name == "Id" && record.GetValue("Id").ToString().Equals("E20")) 
        { 
            rowIndex = e.TableCellIdentity.DisplayElement.GetRowIndex(); 
        } 
 
        if (!record.IsSelected() && record.GetRowIndex() == rowIndex) 
        { 
            record.SetSelected(true); 
        } 
    } 
} 
 
 
Regards, 
Mohanraj G 


Loader.
Live Chat Icon For mobile
Up arrow icon