郁闷了一个下午的小问题

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">
这里strPageCount始终是1!!!


经过csdn各位兄弟的帮助,终于发现是这个东西惹的祸AllowCustomPaging="True",应为AllowCustomPaging="False",整整让我郁闷了一个下午,以此为戒!

posted on 2004-12-28 22:36  找不到服务器  阅读(538)  评论(0编辑  收藏  举报

导航