开发者

Gridview PageIndex not changing on page_Load event

开发者 https://www.devze.com 2023-01-11 21:47 出处:网络
I\'m trying to change pageindex on page_Load event but its not working. I can change page by clicking links in the page after page loaded.

I'm trying to change pageindex on page_Load event but its not working. I can change page by clicking links in the page after page loaded. If this info necessary GridView in UpdatePanel.

protected void Page_Load(object sender, EventArgs e)
{
     /*...Some Codes...*/
     //I'm trying to change page like this.
     G开发者_如何学运维ridView1.PageIndex = Index;
     GridViewPageEventArgs ea = new GridViewPageEventArgs(GridView1.PageIndex);
     GridView1_PageIndexChanging(sender, ea);
}
protected void GridView1_PageIndexChanging(object sender,GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
}


I believe that you need to rebind the data to your gridview after you change the page index.

0

精彩评论

暂无评论...
验证码 换一张
取 消