Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Incremental search in UltraGrid

As discussed in this question:

Is there a built in feature that supports incremental search? So if on the grid, I begin typing "me" it should jump to a row with a column that starts with that. Dev Express has this feature:

Please let met know how we can achieve that without the filter row.

  • 26425
    Offline posted

    Hello Eti, 

    You can utilize our implementation from our documentation by iterating the rows, enter edit mode, perform a SelStart, SelLength, and return the character or phrase. Note, the row object has a IsDataRow property, and IsFilterRow. You can place an "If" check carry out these parameters. 

    if ( null != row )
    	Type rowType = row.GetType( );
    	bool isDataRow = row.IsDataRow;
    	bool isGroupByRow = row.IsGroupByRow;
    	bool isFilterRow = row.IsFilterRow;
    	bool isSummaryRow = row.IsSummaryRow;
    	bool isTemplateAddRow = row.IsTemplateAddRow;


    public static void FindPhrase(UltraGrid grid, String s)
                           foreach (UltraGridRow row in grid.Rows)
                    foreach (UltraGridCell cell in row.Cells)
                        if (cell.Text.Contains(s))
                            //The cell must be activated first
                            //Cell must be in edit mode to perform selection
                            //Start the selection
                            cell.SelStart = cell.Text.IndexOf(s);
                            //For this length
                            cell.SelLength = s.Length;
                            //For eye candy, make this the first visible row
                            grid.DisplayLayout.RowScrollRegions[0].FirstRow = row;

  • 467330
    Offline posted

    Here's a sample I wrote a while back with a class that automatically does a search on the sorted column of the grid: