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

When in grid lifecycle can you set CurrentPageIndex?

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Daresta
Top achievements
Rank 1
James Daresta asked on 09 Nov 2010, 10:29 PM
I am wanting to use a cookie to remember the grid page number so when users go to a detail page and then come back it will remember the page number the grid was on. I have the code below to read the cookie, but I am not sure when in the grid life cycle I should set the CurrentPageIndex. Thanks in advance.

if (CookieUtilities.HasCookieItemValue("crl", "PGN"))
{
    int result;
    if (int.TryParse(CookieUtilities.GetCookieItemValue("crl", "PGN"), out result))
    {
        if (rgSalesCallList_SalesCallReportList.PageCount > result)
        {
            rgSalesCallList_SalesCallReportList.CurrentPageIndex = result;
        }
        else
        {
            rgSalesCallList_SalesCallReportList.CurrentPageIndex = rgSalesCallList_SalesCallReportList.PageCount - 1;
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 10 Nov 2010, 05:07 PM
Hello James,

I suggest you to change the CurrentPageIndex into the RadGrid.Load event. For example:
void RadGrid1_Load(object sender, EventArgs e)
{
     RadGrid1.CurrentPageIndex = 7;
}

I hope this helps.

Greetings,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
James Daresta
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or