一个不错的GridView样式

本文介绍了如何使用CSS为ASP.NET中的GridView控件设置样式,包括表格行、交替行、选中行、编辑行以及表头等元素的具体样式配置。
样式表:
ExpandedBlockStart.gif代码
 <style>
        .GridViewStyle   
        {   
            font
-family: Arial, Sans-Serif;   
            font
-size:small;   
            table
-layout: auto;   
            border
-collapse: collapse;   
            border:#B3D08F 1px solid;   
        }   
        
/*Header and Pager styles*/  
        .HeaderStyle   
        {   
            background
-image:url(../images/HeaderWhiteChrome.jpg);   
            background
-position: center 50%;   
            background
-repeat: repeat-x;   
            color:#
009;   
            font
-size:12px;   
          
               
        }   
          
        .PagerStyle   
        {   
            background
-image:url(../images/tab_14.gif);   
            background
-position: center 50%;   
            background
-repeat: repeat-x;   
            color:#
009;   
            font
-size:12px;   
          
               
        }   
        .HeaderStyle th   
        {   
            padding: 5px;   
            color: #
009;   
        }   
        .HeaderStyle a   
        {   
            text
-decoration:none;   
            color:#ffffff;   
            display:block;   
            text
-align:left;   
            font
-weight:normal;   
        }   
        .PagerStyle table   
        {   
            text
-align:center;   
            margin:auto;   
        }   
        .PagerStyle table td   
        {   
            border:0px;   
            padding:5px;   
        }   
        .PagerStyle td   
        {   
            border
-top: #1d1d1d 1px solid;   
        }   
        .PagerStyle a   
        {   
            color:#
000000;   
            text
-decoration:none;   
            padding:2px 10px 2px 10px;   
            border
-top:solid 1px #777777;   
            border
-right:solid 1px #333333;   
            border
-bottom:solid 1px #333333;   
            border
-left:solid 1px #777777;   
        }   
        .PagerStyle span   
        {   
            font
-weight:bold;   
            color:#
000000;   
            text
-decoration:none;   
            padding:2px 10px 2px 10px;   
        }   
        
/*RowStyles*/  
        .RowStyle td, .AltRowStyle td, .SelectedRowStyle td, .EditRowStyle td 
/*Common Styles*/  
        {   
            padding: 5px;   
            border: solid 1px #B3D08F;   
        }   
        .RowStyle td   
        {   
            background
-color: #ffffff;   
        }   
        .AltRowStyle td   
        {   
            background
-color: #f0f0f0;   
        }   
        .SelectedRowStyle td   
        {   
            background
-color: #ffff66;   
        }  

         
</style>
 
 
GridView定义:
ExpandedBlockStart.gif代码
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" CssClass="GridViewStyle" GridLines="Horizontal" PageSize="20" Width="422px">   
            
 
<RowStyle CssClass="RowStyle" />   
         
 
<PagerStyle CssClass="PagerStyle" />   
  
 
<SelectedRowStyle CssClass="SelectedRowStyle" />   
  
 
<HeaderStyle CssClass="HeaderStyle" BorderColor="#404040" />   
  
 
<EditRowStyle CssClass="EditRowStyle" />   
  
 
<AlternatingRowStyle CssClass="AltRowStyle" />   
</asp:GridView>

 

 

 

转载于:https://www.cnblogs.com/lmjob/archive/2009/12/12/1622590.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值