如何将以下GridView内联样式转换为样式表的类?

时间:2009-06-19 14:13:27

标签: asp.net css gridview

我相信GridView是一个表格,所以如何使用类将以下GridView的内联样式转换为外部样式表呢?

<asp:GridView ID="gvQuotes" 
              runat="server" 
              BackColor="#DEBA84" BorderColor="#DEBA84" 
              BorderStyle="None" BorderWidth="1px" 
              CellPadding="3" CellSpacing="2" 
              GridLines="Both"
              Width="100%"
              ShowFooter="True">

<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" 
          HorizontalAlign="Center" />

<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />

<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />

<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" 
                  ForeColor="White" />

<HeaderStyle BackColor="#A55129" Font-Bold="True" 
             ForeColor="White" Font-Underline="true"
             HorizontalAlign="Center" />

</asp:GridView>

例如,对于整个网格,我是否会执行以下操作并设置CssClass =“grid”

.grid
{
    background-color: #DEBA84;
    border-color:#DEBA84;
    width:100%;

}

我不知道如何处理bordestyle,cellpadding,cellspacing和gridlines

1 个答案:

答案 0 :(得分:0)

检查this。我认为这会对你有所帮助。

这里的关键是如何定位显示表格单元格的某些方法。

table.gridView td
{
    padding:10px; // same as CellPadding on table HTML tag
}