Return to a specific Datagrid Page

pokemon

Member
Joined
Jul 7, 2003
Messages
11
Hi,
I have a page called results.aspx which has a datagrid on with paging enabled. The datagrid displays loads of records, whic all have a dynamic link to another page which displays the record in full.
What i want to do is to be able to pass the page number from results.aspx to the full detail page so that i may return to the correct results.aspx page with out the user having to start from the beginning of the recordlist.

Ive tried searching for this everywhere and have not had a simple solution. I dont care if the values are stored in the URL or as a session variable.
many thanks
John
 
Hi,

either I dont understand you or i have a solution for you:

The paging work serverside. Therefor you have a funktion like this:

Code:
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
//here you do next or previous, your code!

//then save current PageNumber in a Session
Session["CurrentGridPage"] = DataGrid1.CurrentPageIndex;
}

private void Page_Load(object sender, System.EventArgs e)
{
//if Session exists, "jump/page" to the site
if (Session["CurrentGridPage"] != null)
{
DataGrid1.CurrentPageIndex = (int)Session["CurrentGridPage"]; //maybe you have to type: Int32.Parse(Session["CurrentGridPage"].ToString());
}
}

-WebJumper
 
Thanks

Slowly getting to grips with .NET.
Thanks for pointing me in the right direction, got it working.
Cheers
 
Back
Top