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

RadGrid - select row on other page

1 Answer 253 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter Landis
Top achievements
Rank 1
Peter Landis asked on 21 Feb 2010, 03:09 AM
I have followed the examples posted at

http://www.telerik.com/help/aspnet-ajax/grdselectingrowwithclick_client.html

and also looked at the posting

http://www.telerik.com/community/forums/aspnet-ajax/grid/server-side-selecting-row-on-other-grid-page.aspx

When I submit the selected grid items, I am unable to obtain the selected values from other pages on the grid.

I have tried the following code:

           int count = RadGrid1.MasterTableView.PageCount;
            for (int i = 0; i < count; i++)
            {
                RadGrid1.CurrentPageIndex = i;
                RadGrid1.Rebind();  <--- The rebinding appears to remove all selected items.
                foreach (GridDataItem item in RadGrid1.Items)
                {
                    if (item.Selected)
                    {
                        HiddenField hdn = (HiddenField)item.FindControl("hdnFieldID");
                        int AID = int.Parse(hdn.Value);

                        // Perform action
                    }
                }
            }

If I loop through the grid it just obtains the values of the current page.

               foreach (GridDataItem item in RadGrid1.Items)
                {
                    if (item.Selected)
                    {
                        HiddenField hdn = (HiddenField)item.FindControl("hdnFieldID");
                        int AID = int.Parse(hdn.Value);

                        // Perform action
                    }
                }

How can you obtain all selected values on the RadGrid when selected rows exist on other pages?





1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Feb 2010, 06:56 AM
Hi Peter,

Please  have a look at the forum link below where a working sample has been provided on how to access the selected items across paging.The main idea behind it is to store the selected indexes in a  collection which is saved into a session on paging and sorting; then loop through the collection in the button click.


Hope this helps.

Thanks,
Princy
Tags
Grid
Asked by
Peter Landis
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or