由于在模版页中使用gridview空间 我的gridview虽然id是gridview1 但是实际id 似乎已经改变了 进行分页根本无法进入函数
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
// Cancel the paging operation if the user attempts to navigate // to another page while the GridView control is in edit mode. if (GridView1.EditIndex != -1)
{ // Use the Cancel property to cancel the paging operation. e.Cancel = true; int newPageNumber = e.NewPageIndex + 1; } else
{ //main codes go here
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataSource = stdt;
GridView1.DataBind(); }
}
}
其中 stdt 是静态的datatable
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
// Cancel the paging operation if the user attempts to navigate // to another page while the GridView control is in edit mode. if (GridView1.EditIndex != -1)
{ // Use the Cancel property to cancel the paging operation. e.Cancel = true; int newPageNumber = e.NewPageIndex + 1; } else
{ //main codes go here
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataSource = stdt;
GridView1.DataBind(); }
}
}
其中 stdt 是静态的datatable
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货