>Greetings,
>
>I'm working with a gridview with paging turned on that has a select for each row that then simply sends a primary key to another page for displaying the details. On the detail page I have a link that says 'return to search results'. Naturally when I simply navigate back to the previous page the current page that was selected in the grid view is gone and the user is back on the first page. Now I believe I can brute for a way to get this to work but I was hoping someone out there with more experience might have a recommended approach.
>
>Thanks in advance!
>
>Greg
Ok, figured it out.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && Session["DFPageIndex"] != null)
GridView1.PageIndex = (int)Session["DFPageIndex"];
ObjectDataSource1.Select();
GridView1.DataBind();
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
Session["DFPageIndex"] = (int)GridView1.PageIndex;
}
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement