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

[Solved] Select All Checkbox in RadGrid header calls OnRowSelected/OnRowDeselected multiple times

2 Answers 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 23 Apr 2013, 05:31 PM
Hi,

I have a radgrid using the the GridClientSelectColumn with AllowMultiRowSelection = true. The table is rendered with a checkbox in the header to allow a user to select/deselect all rows with one click.

I've wired up the grid using OnRowSelected/OnRowDeselected, so that any selection changes cause some code to run where I do some summarization calculations for display.

This works great, when the user is manually checking/unchecking a row themselves, but in a scenario I'm testing I have 100 rows, and the user clicks the Select all checkbox. This causes the grid to trigger the OnRowSelected event 100 times, which is taking too much time (and I get a slow script error in IE 8).

Is there any easy way to detect when the Select All checkbox is checked or unchecked, and handle this appropriately, so that my summarization code is only called once, not on every OnRowSelected/OnRowDeselected which is triggered?

If not, I may have to hide the original select all checkbox, and recreate this functionality myself, but I'd rather not.

Someone else had this same sort of issue here: http://www.telerik.com/community/forums/aspnet-ajax/grid/detect-final-onrowselected-and-onrowdeselected.aspx

but the solution doesn't work for me, as I need to do the summary on every row select/deselect...

Thanks,
Rich

2 Answers, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 23 Apr 2013, 06:14 PM
I found a solution using timeouts here:

http://stackoverflow.com/questions/7424397/telerik-radgrid-onrowselected-events-all-done-event-for-multiple-selection

But, if there is a better, less hacky solution. I'd like to know.

Thanks,
Rich
0
Kostadin
Telerik team
answered on 26 Apr 2013, 01:43 PM
Hi Steven,

I am afraid I could not provide you with any better solution for your requirement.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or