开发者

Grid view page number spacing?

I have a Grid View shown below (bottom code):

      <asp:BoundField DataField="UID" HeaderText="UID" SortExpression="UID"
                      ItemStyle-Wrap="false">
          <ItemStyle Wrap="False"></ItemStyle>
      </asp:BoundField>
  </Columns>
  <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
  <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="#CCCCFF" />
  <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left"  />
  <RowStyle BackColor="White" ForeColor="#003399" HorizontalAlign="Center" />
  <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
</asp:GridView>

In pager style i have not used any class ...but my page numbers appear too much spacious. I need it together in the middle of the gridview. But it appears to be one at left(Page 1) and after a big space one at center (Page 2).

Can someone help to make my page numbers together in the center of grid view?

PS: Grid View not lies in a <div> or &开发者_C百科lt;table>

but there is a <div> and <table> in my webpage at bottom and top of the grid view


You've set the HorizonalAlignment of the PagerStyle property to Left. Change it to "Center". You can read more about the PagerStyle property here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagerstyle.aspx

The following will center the page numbers in your GridView:

<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Center"  />


If you are looking to increase the space between the Gridview page numbers, add the following style in your page :

          .cssPager td
        {
              padding-left: 4px;     
              padding-right: 4px;    
          }
    </style> 

And reference this style inside your GridView Pager Style :

<PagerStyle CssClass="cssPager" />

Source : http://www.dotnetcurry.com/ShowArticle.aspx?ID=244

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜