Click here to Skip to main content
15,886,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
ASP.NET
<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
Posted
Updated 2-Jul-12 6:46am
v2

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900