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

check all checkboxes in radgrid on button click.

3 Answers 371 Views
Grid
This is a migrated thread and some comments may be shown as answers.
digish devassy
Top achievements
Rank 1
digish devassy asked on 24 Feb 2012, 01:14 PM
Hi,

check all checkboxes in radgrid on button click.  button is placed outside radgrid. I tried thos method on button click.

                CheckBox chb;
                for (int i = 0; i < RadGrid1.Items.Count; i++)
                {
                    chb = (CheckBox)RadGrid1.Items[i].FindControl("chkSelectItem");
                    chb.Checked = true;
                }
This will fix the check boxes in the radgrid on that page. if I move to another page(pagination), it will be unchecked in there.
Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Feb 2012, 01:40 PM
Hello,

Check the following forum thread which discuss the same.
Check-box template column loses status after paging

-Shinu.
0
digish devassy
Top achievements
Rank 1
answered on 28 Feb 2012, 01:40 PM
I am able to check all the button. But When I tried to retrieve all the checked boxes, checked, I am able to get the checkboxes ticked only in the first page.
other page value are not getting retrieved using the code:

 for (int i = 0; i < rdNew.Items.Count; i++)
            {
                CheckBox chkSelected = (CheckBox)rdNew.Items[i].FindControl("chkS");
                String Id = rdNew.Items[i]["id"].Text;
               
                if (chkSelected.Checked && chkSelected != null)
                {
                    if (list.Count == 0)
                    {
                        list.Add(Id);
                    }
                }
            }
I am not getting the total list, of the users checked.
0
Pavlina
Telerik team
answered on 02 Mar 2012, 06:55 AM
Hi,

When paging is enabled in the grid, a solution would be to temporarily disable paging, loop through all the items in the grid, select the items and then enable paging back.

Give this suggestion a try and see if it works for you..

Regards,
Pavlina
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
digish devassy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
digish devassy
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or