grid view page index
-
hi all, how can i maintain gridview page index while navigation from the form and getting back by browser back button. i tried to use this approach:
public int PageIndex
{get { if (Session\["DGApplicationPageIndex"\] != null) { return (int)Session\["DGApplicationPageIndex"\]; } else { return 0; } } set { if (value != -1) { Session\["DGApplicationPageIndex"\] = value; } else { Session\["DGApplicationPageIndex"\] = null; } } }
protected void DGApplication_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
DoSearch(TextBox1.Text);
DGApplication.PageIndex = e.NewPageIndex;
PageIndex = DGApplication.PageIndex;
}protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DoSearch("-1");
}
DGApplication.PageIndex = PageIndex;
PageIndex = -1;}
-
hi all, how can i maintain gridview page index while navigation from the form and getting back by browser back button. i tried to use this approach:
public int PageIndex
{get { if (Session\["DGApplicationPageIndex"\] != null) { return (int)Session\["DGApplicationPageIndex"\]; } else { return 0; } } set { if (value != -1) { Session\["DGApplicationPageIndex"\] = value; } else { Session\["DGApplicationPageIndex"\] = null; } } }
protected void DGApplication_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
DoSearch(TextBox1.Text);
DGApplication.PageIndex = e.NewPageIndex;
PageIndex = DGApplication.PageIndex;
}protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DoSearch("-1");
}
DGApplication.PageIndex = PageIndex;
PageIndex = -1;}
And what happens with this? Why reset the page index?? PageIndex = -1;
only two letters away from being an asset