Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Persisiting the current page in gridview
Message
De
09/08/2009 17:26:59
 
 
À
07/08/2009 15:57:43
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01416832
Message ID:
01416984
Vues:
30
>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
Fil
Voir

Click here to load this message in the networking platform