Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Gridview页面索引在页面加载事件中未更改_C#_Asp.net - Fatal编程技术网

C# Gridview页面索引在页面加载事件中未更改

C# Gridview页面索引在页面加载事件中未更改,c#,asp.net,C#,Asp.net,我正在尝试更改page_Load事件上的pageindex,但它不起作用。 加载页面后,我可以通过单击页面中的链接来更改页面。 如果需要此信息,请在UpdatePanel中查看GridView protected void Page_Load(object sender, EventArgs e) { /*...Some Codes...*/ //I'm trying to change page like this. GridView1.PageIndex = I

我正在尝试更改page_Load事件上的pageindex,但它不起作用。 加载页面后,我可以通过单击页面中的链接来更改页面。 如果需要此信息,请在UpdatePanel中查看GridView

protected void Page_Load(object sender, EventArgs e)
{
     /*...Some Codes...*/
     //I'm trying to change page like this.
     GridView1.PageIndex = Index;
     GridViewPageEventArgs ea = new GridViewPageEventArgs(GridView1.PageIndex);
     GridView1_PageIndexChanging(sender, ea);
}
protected void GridView1_PageIndexChanging(object sender,GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
}

我认为,在更改页面索引后,您需要将数据重新绑定到gridview。

是,在绑定gridview后,我正在尝试更改页面