当AllowPaging ="True"时,不显示页数在asp:GridView(VS2010 – C#)中 [英] Don’t show number of page when AllowPaging="True" in asp:GridView (VS2010 – C#)

查看:181
本文介绍了当AllowPaging ="True"时,不显示页数在asp:GridView(VS2010 – C#)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我使用asp:GridView并设置AllowPaging ="True"和PageSize ="1".但我不想显示页数.我该怎么办?

Hi I use a asp:GridView and set AllowPaging="True" and PageSize="1" . but I don’t want show the number of page. How can I do it?

<contenttemplate>
       <asp:SqlDataSource ID="SqlNews" runat="server" 

            ConnectionString="<%$ ConnectionStrings:ASPNETDB_ConnectionString %>" 

            SelectCommand="SELECT * FROM mytable ">
       
       <asp:GridView ID="GridNews" runat="server" BorderStyle="None"

                     AllowPaging="True" AutoGenerateColumns="False" 

                     PageSize="1"  DataKeyNames="newsId" DataSourceID="SqlNews" 

                     ShowHeader="false" ShowFooter="false" onrowcommand="GridNews_RowCommand">
                     <pagersettings nextpagetext="&gt;" previouspagetext="&lt;" />
                         <columns>
                            <asp:TemplateField>
                               <itemtemplate>
                                   <table border="0" cellpadding="0" cellspacing="0">
                                         <tr style="padding-removed5px;">
                                              <td>
                                                  <asp:ImageButton ID="imgbtnNews" runat="server" Width="200px" Height="200px" ImageUrl='<%#FindImageUrl(Eval("newsPicUrl")) %>' CommandName="ShowNews" CommandArgument='<%#Eval("newsId") %>'/>
                                              </td>
                                         </tr>
                                   </table>
                               </itemtemplate>
                            
                         </columns>
                         <pagerstyle cssclass="gridPager" borderstyle="None" horizontalalign="Center">
                                     VerticalAlign="Middle" />
       
       <asp:Timer ID="Timer1" runat="server" Interval="2500" ontick="Timer1_Tick">


非常感谢


Thanks very much

推荐答案

ConnectionStrings:ASPNETDB_ConnectionString%>" =" 选择*来自mytable" < asp:GridView ID =" runat 服务器" BorderStyle 无" AllowPaging =" AutoGenerateColumns =" PageSize =" =" newsId" DataSourceID =" ShowHeader =" ShowFooter =" =" GridNews_RowCommand" < 页面设置 =" & gt;" 上一页文本 =" / < > < asp:TemplateField > < itemtemplate > < =" 0" cellpadding > 0" 单元格间距 =" 0" < tr =" < td > < asp:ImageButton ID =" runat 服务器" 宽度 200像素" 高度 200px" ImageUrl =' <%# FindImageUrl(Eval(" ) )%>' CommandName =" ShowNews" CommandArgument =' <% #Eval( newsId")%>' > < /td > < /tr > < /table > < /itemtemplate > < /列 > < 寻呼机 样式 cssclass =" gridPager" 边框 =" 水平对齐 =" < asp:Timer ID =" runat 服务器" 时间间隔 2500" 勾选 Timer1_Tick"
ConnectionStrings:ASPNETDB_ConnectionString %>" SelectCommand="SELECT * FROM mytable "> <asp:GridView ID="GridNews" runat="server" BorderStyle="None" AllowPaging="True" AutoGenerateColumns="False" PageSize="1" DataKeyNames="newsId" DataSourceID="SqlNews" ShowHeader="false" ShowFooter="false" onrowcommand="GridNews_RowCommand"> <pagersettings nextpagetext="&gt;" previouspagetext="&lt;" /> <columns> <asp:TemplateField> <itemtemplate> <table border="0" cellpadding="0" cellspacing="0"> <tr style="padding-removed5px;"> <td> <asp:ImageButton ID="imgbtnNews" runat="server" Width="200px" Height="200px" ImageUrl='<%#FindImageUrl(Eval("newsPicUrl")) %>' CommandName="ShowNews" CommandArgument='<%#Eval("newsId") %>'/> </td> </tr> </table> </itemtemplate> </columns> <pagerstyle cssclass="gridPager" borderstyle="None" horizontalalign="Center"> VerticalAlign="Middle" /> <asp:Timer ID="Timer1" runat="server" Interval="2500" ontick="Timer1_Tick">


非常感谢


Thanks very much


我使用asp:GridView并设置AllowPaging ="True"和PageSize ="1".但我不想显示页数
如果是这样,那么分页有什么意义呢?只需获取所需的记录数并显示即可.

很难理解这样的要求! :doh:

不过,如果您想隐藏寻呼机,请使用: MSDN: GridView.PagerSettings属性 [ ^ ]-为此设置Visible = False.
I use a asp:GridView and set AllowPaging="True" and PageSize="1" . but I don’t want show the number of page
If so, then whats the point of having a pagination at all? Just fetch the desired number of records and show it.

Difficult to understand such requirements! :doh:

Still, if you want to hide the pager, use: MSDN: GridView.PagerSettings Property [^] - set Visible = False for it.


这篇关于当AllowPaging ="True"时,不显示页数在asp:GridView(VS2010 – C#)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆