【问题标题】:Grid view page number spacing?网格视图页码间距?
【发布时间】:2011-08-27 10:42:54
【问题描述】:

我有一个如下所示的网格视图(底部代码):

      <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>

在寻呼机样式中,我没有使用任何类...但是我的页码显得过于宽敞。 我需要它在gridview的中间。但它似乎是一个在左边(第 1 页),在一个大空间之后在中间(第 2 页)。

有人可以帮忙把我的页码放在网格视图的中心吗?

PS:网格视图不在&lt;div&gt;&lt;table&gt;

但是在我的网页中网格视图的底部和顶部有一个&lt;div&gt;&lt;table&gt;

【问题讨论】:

    标签: c# .net asp.net gridview


    【解决方案1】:

    您已将 PagerStyle 属性的 Horizo​​nalAlignment 设置为 Left。将其更改为“中心”。您可以在此处阅读有关 PagerStyle 属性的更多信息:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagerstyle.aspx

    以下内容将使您的 GridView 中的页码居中:

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

    【讨论】:

      【解决方案2】:

      如果您希望增加 Gridview 页码之间的间距,请在您的页面中添加以下样式:

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

      并在您的 GridView Pager Style 中引用此样式:

      <PagerStyle CssClass="cssPager" />
      

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-19
        • 1970-01-01
        相关资源
        最近更新 更多