GridView CSS的完整样式表

 

.GridViewStyle
  {  
      border-right: 2px solid white;
      border-bottom: 2px solid white;
      border-left: 2px solid white;
      border-top: 2px solid white;
      padding: 18px;
      width:500px;
      font-size:15px;
 }
 
.GridViewHeaderStyle th
{
     border-left: 1px solid #EBE9ED;
     border-right: 1px solid #EBE9ED;
}

.GridViewHeaderStyle
{
     background-color: #5D7B9D;
     font-weight: bold;
     color: White;
}

.GridViewFooterStyle
{
     background-color: #5D7B9D;
     font-weight: bold;
     color: White;
}

.GridViewRowStyle
{
     background-color: #F7F6F3;
     color: #333333;
}

.GridViewAlternatingRowStyle
{
     background-color: #FFFFFF;
     color: #284775;
}

.GridViewRowStyle td, .GridViewAlternatingRowStyle
{
     border: 1px solid #EBE9ED;
}

.GridViewSelectedRowStyle
{
     background-color: #E2DED6;
     font-weight: bold;
     color: #333333;
}


.GridViewPagerStyle
{
     background-color:#5D7B9D;
     color: #FFFFFF;
}

.GridViewPagerStyle table
{
     margin: 0 auto 0 auto;
}

li.gobackMain a
{
 color:Blue;
}



以下为使用示例: 关键部分
<asp:GridView ID="GridView1" runat="server"  onpageindexchanging="GridView1_PageIndexChanging" CssClass="GridViewStyle">
                <FooterStyle CssClass="GridViewFooterStyle" />
                <RowStyle CssClass="GridViewRowStyle" />  
                <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                <PagerStyle CssClass="GridViewPagerStyle" />
                <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                <HeaderStyle CssClass="GridViewHeaderStyle" />

                <Columns>
                   <asp:BoundField DataField="文件名" HeaderText="文件名" />
                   <asp:TemplateField HeaderText="下载路径">
                        <AlternatingItemTemplate>
                            <a href='<%#eval_r("路径") %>'>下载</a>
                        </AlternatingItemTemplate>
                        <ItemTemplate>
                            <a href='<%#eval_r("路径") %>'>下载</a>
                        </ItemTemplate>
                  </asp:TemplateField>
                </Columns>

                <EmptyDataTemplate>
                    提示:当前没有任何记录
                </EmptyDataTemplate>
            </asp:GridView>

上一篇:iquery动态生成bootstrap表格


下一篇:[小工匠说CSS]-盒子模型-概述