本文介绍了我在刷新页面时具有带有分页的gridview,我希望将其保留在gridview的同一页面索引上.目前它转到gridview的首页索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当刷新页面时,我具有带有分页的gridview,我希望将其保留在gridview的同一页面索引上.目前,它转到gridview
i have gridview with paging when i refresh the page, i want to remain it on same page index of gridview. presently it goes to first page index of gridview
推荐答案
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
Gridview1.PageIndex =convert.ToInt32(Session["PageIndex"])
}
}
Session["index"] = GridView1.PageIndex;
页面加载:
On page load:
if(!Page.IsPostBack)
{
//bind gridview
GridView1.PageIndex = Convert.ToInt32(Session["index"]);
}
如果这解决了您的问题,请标记为答案
问候,
爱德华(Eduard)
Please mark as answer if this solved your problem
Regards,
Eduard
这篇关于我在刷新页面时具有带有分页的gridview,我希望将其保留在gridview的同一页面索引上.目前它转到gridview的首页索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!