RadGrid - select row on other page

2 posts, 0 answers
  1. Peter Landis
    Peter Landis avatar
    2 posts
    Member since:
    Jul 2009

    Posted 20 Feb 2010 Link to this post

    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?





  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Feb 2010 Link to this post

    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
Back to Top