Winforms RadGridView - Expand all parents that meet search criteria

1 Answer 93 Views
GridView
R.D. Henry and Co.
Top achievements
Rank 2
Iron
Iron
Iron
R.D. Henry and Co. asked on 14 Jan 2022, 03:55 PM | edited on 14 Jan 2022, 03:55 PM

How can I get all parent rows to expand when the search criteria is met?  Currently, only the parent of the first occurrence of the search result expands.  

Other parents have to be manually expanded to see if the search was found.

Thanks

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 19 Jan 2022, 09:40 AM

Hi Curtis Hines,

What comes up to my mind is to get the GridViewSearchRowInfo row. In its SearchProgressChanged event handler, you can get all cells that match the searching criteria. Then you can get their row info object and set their IsExpanded property to true.

GridViewSearchRowInfo searchRow; searchRow = this.radGridView1.MasterView.TableSearchRow;
searchRow.SearchProgressChanged += SearchRow_SearchProgressChanged;

private void SearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e)
{
    if(e.Cells != null)
    {
        foreach (GridSearchResultCellInfo cell in e.Cells)
        {
            cell.RowInfo.IsExpanded = true;
        }
    }            
}

I have tested this approach on my side and it is working. But the project is pretty simple and I am not sure if it is going to cover all your scenarios but you can try it. You can share if it is working in your application.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
R.D. Henry and Co.
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or