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

Extracting edited items across multiple pages in a radgrid

3 Answers 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 16 Mar 2011, 10:39 AM
Hi,

           i have a radgrid with allowpaging = true and allowmultiplerowedit = true. I have a checkbox column in the grid. When i load the grid in edit mode the values of the checkboxes will be changed by the user. User can check or uncheck multiple checkboxes across pages at one go. But when i try to retrieve the edited values in server side using the below snippet i am getting only the edited values of current page.
foreach (GridEditableItem editedItem in grid.EditItems)
                    {
                        Hashtable newValues = new Hashtable();
                        //The GridTableView will fill the values from all editable columns in the hash
                        grid.MasterTableView.ExtractValuesFromItem(newValues, editedItem);
  
                        if (true == (bool)newValues["myCheckBoxColumn"])
                        {
                            // processing logic
                        }
                    }

Please help me with a sample code snippet, so that i can get the edited values in other pages as well.

Thanks,
Saravanan K

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Mar 2011, 12:08 PM
Hello Saravanan,

To access all items in all pages into the radGrid you could try following approach:
Disable the grid paging, temporarily, retrieve all the rows and then enable paging back again. This approach could be achieved by setting the AllowPaging property of the grid to false at a certain stage of the lifecycle and rebind the control invoking its Rebind() method, then traverse all items in it.

C#:
grid.AllowPaging = false;// disabling paging
grid.Rebind();
foreach (GridEditableItem editedItem in grid.EditItems)
   {
     .  .  .  .               
   }
grid.AllowPaging = true;// re-enable paging
grid.Rebind();

Also you can refer the following documentation which explains how to persist the selected rows server-side on sorting/paging/filtering/grouping. Use the same logic and make necessary modification.
Persisting the selected rows server-side on sorting/paging/filtering/grouping

Thanks,
Princy.
0
saravanan k
Top achievements
Rank 1
answered on 16 Mar 2011, 01:02 PM
Hi Princy,

              Thanks for the reply. Your first suggestion was good. I have applied it.

But the second one doesnt suit my requirement. My grid is loaded in edit mode and remains in edit mode till the end. There is no select and deselect concept to a row. When i change values in few rows and navigate to next page and come back to the previous page the changes i made are not persisted. 

Kindly help me to tackle this scenario.

Regards,
Saravanan K
0
Princy
Top achievements
Rank 2
answered on 17 Mar 2011, 08:39 AM
Hello Saravanan,

You can try the approach mentioned in the following forum to achieve this.
Textbox value persistance in Radgrid

Thanks,
Princy.
Tags
Grid
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
saravanan k
Top achievements
Rank 1
Share this question
or