开发者

Gridview PageIndex not changing on page_Load event

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜