This is a migrated thread and some comments may be shown as answers.

Access only filtered rows in grid

9 Answers 1530 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cory
Top achievements
Rank 1
Cory asked on 31 Oct 2011, 05:07 AM
How do I access only the filtered rows in a grid.  I basically need to select the first row that is visible after setting a filter.  I also have other needs for accessing only the rows that are still visible after a filter, but this is my first need.

9 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Nov 2011, 03:01 PM
Hi Cory,

Thank you for writing.

The filtered, sorted or grouped rows can be found in the ChildRows collection of the desired template. So in order to select the first row after the filtering operation, please consider the following code:
radGridView1.ChildRows[0].IsSelected = true;

I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
 
Kind regards,
Stefan
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Cory
Top achievements
Rank 1
answered on 02 Nov 2011, 03:57 PM
Thank you!  That's perfect.
0
Stefan
Telerik team
answered on 07 Nov 2011, 09:43 AM
Hi Cory,

I am glad that I could help. If there is anything else we can assist you with, do not hesitate to contact us.
 
All the best,
Stefan
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Christopher
Top achievements
Rank 1
answered on 21 Sep 2012, 03:20 PM
Hi Stefan,

Could I get an answer for Cory's second question? I am trying to get the rows that are visible in the gridview after filtering has been applied.

interating with row.isvisible and row.selected dont seem to work.

Thanks,
Chris
0
Stefan
Telerik team
answered on 25 Sep 2012, 11:53 AM
Hi Christopher,

The filtered, sorted or grouped rows can be found in the ChildRows collection of the desired template. The currently visible rows can be found in radGridView1.TableElement.VisualRows. Please note that the latter collection contains of GridRowElement objects and you need to access their RowInfo property to access the actual data row.
 
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Jerry
Top achievements
Rank 1
answered on 28 Dec 2017, 06:09 PM

Using Silverlight and MVVM, we have a RadGridView where users can filter rows. That works great, only the rows that meet the filter display in the RadGridView.

But we also have a checkbox on top of the RadGridView to "Select All" rows. When checked, a method in our ViewModel is called to perform a ForEach() over the Observable that is bound to the ItemsSource of the RadGridView. However, we can't tell which row is filtered by the UI control, so all rows get checked, which is wrong.

How can we read the RadGridView ChildRows property from a ViewModel?

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Dec 2017, 08:29 AM
Hello, Jerry, 

Thank you for writing.  

I would like to note that this forum is related to the Telerik UI for WinForms suite. However, your question seems to be related to Silverlight. Feel free to post your inquiries in the relevant forum: https://www.telerik.com/forums

I hope this information helps. 
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Michael
Top achievements
Rank 1
answered on 12 Dec 2018, 10:41 PM

Hi,

 

I have  radgrid view with thousands of records.  Grid has paging enabled with 50 records per page.  I am using built-in filter option to filter some data. The result can be more than 50 records, hence more than 1 page.  I need to perform some action on the backend on all filtered records.

 

How do I get a list of all filtered records? I tried your suggestion ChildRows, but it returns up to 50 rows.  Looks like it is just list of records currently visible on a page.  I need to get all filtered records, no matter how many pages there are.  Is it possible and how?  If this is not possible, is it possible hook up to events of filter changes and get all parameters of filters so I can apply filter to the binded dataset myself?

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Dec 2018, 12:16 PM
Hello, Michael,     

When paging is enabled, the ChildRows collection contains the data rows displayed on the specific page. In order to get all filtered data, you can first disable the paging, iterate the ChildRows collection and enable again the paging. 

Alternatively, the MasterTemplate.DataView.Indexer.Items contains all the rows in the order in which they appear in the grid. 

foreach (GridViewRowInfo row in ((GridDataView)grdDummy.MasterTemplate.DataView).Indexer.Items)
{
    Console.WriteLine(row.Cells[1].Value);
}

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Cory
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Cory
Top achievements
Rank 1
Christopher
Top achievements
Rank 1
Jerry
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Michael
Top achievements
Rank 1
Share this question
or