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

Problem hold values when paging

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mathieu cupryk
Top achievements
Rank 1
mathieu cupryk asked on 31 Aug 2012, 04:21 PM
http://www.telerik.com/community/code-library/aspnet-ajax/grid/radgrid-client-side-toggle-selection-with-server-side-persisting-of-the-selected-items-after-sorting-filtering-and-paging.aspx

In reference to this article.
After you click on the button and save the entries. Only the selected rows on the first page are still being displayed. The other rows are loss.
This is the issue:
void RadGrid1_PreRender(object sender, EventArgs e)
     {
         string IDs = string.Empty;
         string rowIDs = string.Empty;
         foreach (GridDataItem item in RadGrid1.MasterTableView.Items)--->
         {
             CheckBox checkBox = item["template"].FindControl("CheckBox1") as CheckBox;
             if (checkBox.Checked)
             {
                 IDs = IDs + item["LinkNumber"].Text + ",";
                 rowIDs = rowIDs + item.ClientID.ToString() + ",";
             }
         }
         if (!string.IsNullOrEmpty(IDs))
         {
             IDs = IDs.Substring(0, IDs.LastIndexOf(","));
             int rowCount = RadGrid1.PageSize;
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "setSelectedAfterPostback", "setSelectedAfterPostback('" + rowIDs + "', " + rowCount + ");", true);
             Label1.Text = IDs;
         }
     }

Please let me when there is a fix.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 03 Sep 2012, 03:17 PM
Hello Mathieu,

Everything is working as expected on my side. If you click the first button you get all the ID's of the selected rows on the current page. If you click the second button you get a list of all the selected rows of the whole grid. Could you provide more information or pictures of the issue in order to examine the behavior you are facing?

All the best,
Kostadin
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
mathieu cupryk
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or