郁闷了一个下午的小问题
Post post=new Post(ConfigurationSettings.AppSettings["ConnectionString"]);//数据类
DataTable dtPost=post.GetBoardPost(iBoardId);//得到数据表
this.DataGrid1.DataSource=dtPost;//指定数据源
this.DataGrid1.DataBind();//绑定
strPageCount=this.DataGrid1.PageCount.ToString();//页数
strCurrentPage=(this.DataGrid1.CurrentPageIndex+1).ToString();//当前页
/////////////////////////////////////////////
<asp:datagrid id="DataGrid1" AllowCustomPaging="True" ShowFooter="True" BorderWidth="0px" HorizontalAlign="Center"
CellPadding="0" BackColor="#575757" GridLines="None" AutoGenerateColumns="False" PageSize="30"
AllowPaging="True" Width="97%" runat="server">
DataTable dtPost=post.GetBoardPost(iBoardId);//得到数据表
this.DataGrid1.DataSource=dtPost;//指定数据源
this.DataGrid1.DataBind();//绑定
strPageCount=this.DataGrid1.PageCount.ToString();//页数
strCurrentPage=(this.DataGrid1.CurrentPageIndex+1).ToString();//当前页
/////////////////////////////////////////////
<asp:datagrid id="DataGrid1" AllowCustomPaging="True" ShowFooter="True" BorderWidth="0px" HorizontalAlign="Center"
CellPadding="0" BackColor="#575757" GridLines="None" AutoGenerateColumns="False" PageSize="30"
AllowPaging="True" Width="97%" runat="server">
经过csdn各位兄弟的帮助,终于发现是这个东西惹的祸AllowCustomPaging="True",应为AllowCustomPaging="False",整整让我郁闷了一个下午,以此为戒!