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

Set a grids visible page...

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 24 Nov 2010, 06:28 PM
How can I set the visible page of a rad grid in the code behind of an aspx page?

Supposing I have a grid with 100 pages, and a user is on the 50th page of data and clicks on a link in one of the rows which redirects them to another page. When they click the "Back" button, they are taken to the first page of the grid and have to navigate back to the 50th page.

Can anyone tell me if this is possible without setting up routes?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Nov 2010, 06:18 AM
Hello,


One suggestion is saving the PageIndex in a Session variable and set the CurrentPageIndex property of the grid when clicking the back button in the redirected page.
protected void RadGrid1_PageIndexChanged(object sender, Telerik.Web.UI.GridPageChangedEventArgs e)
{
    Session["pageIndex"] = e.NewPageIndex;
    Response.Redirect(url);      
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (Session["pageIndex"] != null)
    {
        RadGrid1.MasterTableView.CurrentPageIndex = Convert.ToInt32(Session["pageIndex"]);
        RadGrid1.MasterTableView.Rebind();
    }
}


Regards,
Shinu.
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or