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
595
How can you select all rows when Paging is enabled?
posted

I am using the WebDataGrid with the Paging and Selection behaviours.

How can I select all rows by pressing a button? Currently I've tried something like the following:

 // Disable paging so that all rows are accessible from the Rows collection


                    bool paged = Behaviors.Paging != null && Behaviors.Paging.Enabled;
                    if (paged)
                    {
                        Behaviors.Paging.Enabled = false;
                    }

                    // Select all the rows
                    foreach (GridRecord row in Rows)
                    {
                        if (!selection.SelectedRows.Contains(row))
                        {
                            selection.SelectedRows.Add(row);
                        }
                    }

                    // If the grid was previously paged, re-enable the paging
                    if (paged)
                    {
                        Behaviors.Paging.Enabled = true;
                    }

But this doesn't work. Can anyone please offer any assistance?