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

Checkboxes - select all when paging is on

13 Answers 616 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam Gross
Top achievements
Rank 1
Adam Gross asked on 16 Aug 2010, 10:11 PM
I want to create a databound RadGrid that with checkboxes in a column and enable a user to check/uncheck all boxes in the dataset, not just what's displayed on in the current paged dataset.  So, if I have 6000 records but only 50 are displayed, I want to be able to Check/Uncheck All and have it check or uncheck all records, not just the 50 displayed.  Then I want to submit this back to the database to update the records.

13 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Aug 2010, 05:16 AM
Hi,


Refer the following forum link which discusses how to select all the rows in grid regardless of paging. Hope it will shed some light in implementing the functionality.
Checkbox Select - Multiple Pages

-Shinu.
0
Adam Gross
Top achievements
Rank 1
answered on 20 Aug 2010, 07:55 PM
I am able to get the records to stay selected when paging now.  The challenge is that I have 5000 records that I need to select with a select all checkbox.  I found this post which suggests turning off paging, rebinding, selecting all records,turning back on paging then rebinding.  http://www.telerik.com/community/forums/aspnet/grid/checkbox-select---multiple-pages.aspx.  I have tried that and it works fine for smaller datasets but with 5000 records, it times out.  Is there some other way that I can check all records and still have paging and filtering capability?  I thought about accessing the datasource directly, but I would have to parse the filters in order to affect the correct dataset.
0
Nikolay Rusev
Telerik team
answered on 26 Aug 2010, 07:52 AM
Hello Adam,

RadGrid have in memory only current page items. If you need all items you should disable paging. However if you have a lot of records to be displayed there will be performance penalties.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tonino
Top achievements
Rank 1
answered on 21 Jan 2011, 02:35 PM
Hello!

I just checked out the project pagingsortingwithclientsideselecting-ajax.zip from this Code Library referenced from this page and found a strange behaviour: the 'select all' checkbox gets selected when returning to page 2.

Steps to reproduce the issue:
1) Start the project
2) Select row 1 on page 1
3) Select row 2 on page 2
4) Navigate to page 1 and back to page 2
5) The 'select all' checkbox is selected!!!

Can someone confirm this? Or even better: is there a workaround for this?

Regards,
Tonino.
0
Nikolay Rusev
Telerik team
answered on 27 Jan 2011, 10:07 AM
Hello Tonino,

The code library is about to be modified with correct code. For your convenience I am attaching how this scenario should be properly implemented.

Greetings,
Nikolay
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Tonino
Top achievements
Rank 1
answered on 27 Jan 2011, 04:52 PM

Hi Nikolay
Thanks for your reply! Now it works like a charm!

Another question: is it possible to have this feature (selecting items on more than one page client-side) [feature A] and enable selection of rows just by clicking the checkbox (no selection when row is clicked elsewhere) [feature B].

The problem that I encountered is that the function CancelNonInputSelect() allows just selection generated by clicking a checkbox. But this interferes with set_selected for the other feature [feature A] ...

Here some details of the implementation of feature B:

<ClientEvents OnRowSelecting="CancelNonInputSelect" OnRowDeselecting="CancelNonInputSelect" />

//cancel all select/deselect operation triggered by non-checkbox row clicks
function CancelNonInputSelect(sender, args) {
   var e = args.get_domEvent();
   //IE - srcElement, Others - target
   var targetElement = e.srcElement || e.target;
   //this condition is needed if multi row selection is enabled for the grid
   if (typeof (targetElement) != "undefined") {
      //is the clicked element an input checkbox? <input type="checkbox"...>
      if (targetElement.tagName.toLowerCase() != "input" &&
         (!targetElement.type || targetElement.type.toLowerCase() != "checkbox")) {
         args.set_cancel(true);
         return;
      }
   }
   else {
      args.set_cancel(true);
      return;
   }
}

Regards,
Tonino.
0
Nikolay Rusev
Telerik team
answered on 28 Jan 2011, 03:55 PM
Hello Tonino,

You can use
 <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true"></Selecting>

to enable selection only when GridClientSelectColumn is clicked.

Greetings,
Nikolay
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Tonino
Top achievements
Rank 1
answered on 31 Jan 2011, 08:32 AM
Hi Nikolay
Thanks for the hint! I wasn't aware of this new setting. That makes it easy!

I would be helpful to refere to the new feature on this page:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/clientsideselectcolumn-disallow-other-selection.aspx

Regards,
Tonino.
0
Iana Tsolova
Telerik team
answered on 31 Jan 2011, 05:17 PM
Hi Tonino,

Thank you for pointing this to us.
We will update the code library shortly.

Best wishes,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Luis Barahona
Top achievements
Rank 1
answered on 21 Jun 2011, 05:30 PM
I'm trying the same links and I get an error(http://www.telerik.com/community/forums/aspnet/grid/checkbox-select---multiple-pages.aspx). How can I achieve selecting all the items from a radgrid not only the ones of the first page of my radgrid when paging is on? the code below will bring the items from the first page only.... and I need to select all the items from the radgrid...
best regards,
Luis
For Each item As GridDataItem In Radgrid1.MasterTableView.Items
 
      
Next
0
Iana Tsolova
Telerik team
answered on 23 Jun 2011, 01:32 PM
Hi Luis,

In fact this is not possible, because the grid is creating only the items for the current page. So the items for the rest of the pages are not available at all.

Best wishes,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Raji
Top achievements
Rank 1
answered on 30 Nov 2015, 06:55 PM

hi,

 Kindly help me how to have a select all option that selects only those entries that are in that particular page alone not the entire dataset.Help to solve the issue

0
Eyup
Telerik team
answered on 09 Dec 2015, 09:51 AM
Hello Rajalakshmi,

The mentioned functionality is the default multi-selection provided by RadGrid:
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/selecting/row-selection/defaultcs.aspx

Do you have something else in mind?

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Adam Gross
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Adam Gross
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Tonino
Top achievements
Rank 1
Iana Tsolova
Telerik team
Luis Barahona
Top achievements
Rank 1
Raji
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or