GridView的 为什么不显示出来

jupiterax 2014-07-14 04:01:04
前台代码如下:
<asp:Panel ID="Panel1" runat="server" Width="950px" Height="400px">
<asp:GridView ID="dgv_GWCheck" runat="server" RowHeadersVisible="true"
AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" PageSize="3"
BorderStyle="None" BorderWidth="1px" CellPadding="4" EmptyDataText="没有数据"
DataSourceID="GWCheckEntity" ForeColor="Black" DataKeyNames="G_ID"
Width="950px" AllowPaging="True" AllowCustomPaging="true">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="G_ID" ReadOnly="True" Visible="false"
SortExpression="G_ID" >
<ItemStyle />
</asp:BoundField>
<asp:BoundField DataField="Statue" HeaderText="状态" ReadOnly="True"
SortExpression="Statue" >
<ItemStyle Width="65px" />
...........

</Columns>
<FooterStyle BackColor="#CCCC99" />
<HeaderStyle BackColor="#CCCC99" Font-Bold="True" ForeColor="White" Font-Size="16px" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FBFBF2" />
<SortedAscendingHeaderStyle BackColor="#848384" />
<SortedDescendingCellStyle BackColor="#EAEAD3" />
<SortedDescendingHeaderStyle BackColor="#575357" />
<RowStyle HorizontalAlign ="Center" Height="5px" />
<HeaderStyle Height="15px" />
<PagerTemplate>当前页:<asp:Label ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>  
共<asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label>页  
<asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" OnCommand="PageButtonClick"
Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" OnCommand="PageButtonClick"
Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" OnCommand="PageButtonClick"
Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一页</asp:LinkButton> 

<asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" OnCommand="PageButtonClick"
Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾页</asp:LinkButton> 

转<asp:TextBox ID="UserDefinePage" runat="server" Width="30px"></asp:TextBox>页 <asp:LinkButton ID="TurnPage" CommandName="go" runat="server">GO</asp:LinkButton></PagerTemplate>
</asp:GridView>
<asp:SqlDataSource ID="GWCheckEntity" runat="server" ConnectionString="<%$ ConnectionStrings:SCZF_OAConnectionString %>" SelectCommand="SELECT G_ID,Statue,G_Title,Dep_Name,U_Name,G_RegisterTime FROM [Table_GongWenRegister],[Table_UserInfo],[Table_Department] WHERE Table_GongWenRegister.U_ID=Table_UserInfo.U_ID AND Table_UserInfo.U_statue='在职'AND Table_UserInfo.Dep_ID=Table_Department.Dep_ID"></asp:SqlDataSource>

</asp:Panel>

数据库中的记录数绝对多余3条。就是显示不出PagerTemplate里面的内容
...全文
257 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Rajesh_James 2014-07-15
  • 打赏
  • 举报
回复
数据量不足一页的话是不会出现的
wangnaisheng 2014-07-15
  • 打赏
  • 举报
回复
http://www.cnblogs.com/weiqt/articles/2031683.html 你要是想分页的话,那么使用使用AspNetPager控件实现GridView分页吧。 很强大的控件哈。
Rajesh_James 2014-07-15
  • 打赏
  • 举报
回复
sorry ! 没看到PageSize = 3

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧