GridViewCheckBoxColumn check/uncheck all only filtered data

1 Answer 702 Views
Buttons, RadioButton, CheckBox, etc GridView
Shawn
Top achievements
Rank 1
Shawn asked on 12 Aug 2021, 06:26 PM

I have a Telerik WinForm RadGridView and I have a GridViewCheckBoxColumn column where the user can check/uncheck all of the rows in the grid. I'm able to click the header check box to uncheck or check all of the rows. I'm trying to implement the ability that it will only check or uncheck all of the visible rows in the grid. For example, if the user filtered one of the columns I'd like the header check/uncheck to only toggle based on the filtered rows and not all the rows. Currently, it appears the default functionality is to change all the rows.

I found this article: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/rows-vs-childrows that explains how you can access either the rows or childrows collections to access all the data or the filtered data. I added an event to the CellValueChanged event and created a break point in that new method. Within that event the rows and childrows are the same (i.e. the row count was the exact same). However, within the ValueChanged event it correctly shows the childrows based on the current filters.

Is there another event where I should be capturing the check/uncheck event from the header that correctly lists the childrows data?

I tried creating a separate button to toggle the check boxes and used this article: https://www.telerik.com/forums/how-to-get-all-row-with-checkboxcolumn-checked to update the rows. But I have more than 5,000 records and it takes a very long time to iterate over all the rows. Is there an easier way to uncheck/check all the rows other than iterating over the rows collection?

 

Shawn
Top achievements
Rank 1
commented on 12 Aug 2021, 07:05 PM

I figured it out, there's a property on the GridViewCheckBoxColumn class named CheckFilteredRows that toggles that feature.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Aug 2021, 11:18 AM

Hello, Shawn,

I am glad that the problem you were facing is now resolved.

Indeed, the CheckFilteredRows property is the correct way to control whether the filtered rows will be toggled or not. More information about the other options that the column offers is available in the online documentation:

https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewcheckboxcolumn 

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
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
Buttons, RadioButton, CheckBox, etc GridView
Asked by
Shawn
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or