为GridViev自定义皮肤(Skin&&CSS)

以前用VS自带的GridView太没有创意了,所以做了一个GridView的皮肤以备不时之需。
    Skin:    
<% --
默认的外观模板。以下外观仅作为示例提供。

1. 命名的控件外观。SkinId 的定义应唯一,因为在同一主题中不允许一个控件类型有重复的 SkinId。

<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >

   
<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>

2. 默认外观。未定义 SkinId。在同一主题中每个控件类型只允许有一个默认的控件外观。

<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
 
--
%>

<asp:GridView runat="server" SkinId="Default" CssClass="GridFrame"  CellPadding="0" CellSpacing="0" AutoGenerateColumns="False">

<RowStyle CssClass="GridItem" />

<EditRowStyle CssClass="GridEdit" />

<SelectedRowStyle CssClass="GridHeader" />

<PagerStyle CssClass="GridItem" />

<HeaderStyle CssClass="GridHeader" />

<FooterStyle CssClass="GridFooter" />

<AlternatingRowStyle CssClass="GridAlter" />

</asp:GridView>

    CSS:
.GridFrame
{}
{
    margin-top
: 5px;
    border-collapse
: collapse;
    border-right
: #7c9ccf 1px solid;
    border-top
: #7c9ccf 1px solid;
    border-left
: #7c9ccf 1px solid;
    border-bottom
: #7c9ccf 1px solid;
}

.GridItem td ,.GridAlter td
{} {
    border-right
: #999999 1px solid;
    border-top
: #999999 1px solid;
    border-left
: #999999 1px solid;
    border-bottom
: #999999 1px solid;
}

.GridItem
{} {
    font-family
: arial;
    font-size
: 9pt;
    background
: #f1f1f1;
    padding
: 0px 4px 0px 4px;
    height
: 14px;
}


.GridEdit
{} {
    font-family
: arial;
    font-size
: 9pt;
    background
: #ffffff;
    padding
: 0px 4px 0px 4px;
    height
: 14px;
}


.GridHeader
{} {
    font
: bold ;
    font-family
: 宋体;
    font-size
: 9pt;
    background
: #8caae7;
    border-bottom
: #7c9ccf 1px solid;
    border-top
: #7c9ccf 1px solid;
    color
: #ffffff;
    text-align
:center;
    height
:18px;
}

.GridHeader th
{} {
    font
: bold ;
    font-family
: 宋体;
    font-size
: 9pt;
    background
: #8caae7;
    border-bottom
: #7c9ccf 1px solid;
    border-top
: #7c9ccf 1px solid;
    color
: #ffffff;
    text-align
:center;
}


.GridAlter
{} {
    font-family
: arial;
    font-size
: 9pt;
    background
: #f1f1f1;
    padding
: 0px 4px 0px 4px;
    height
: 14px;
}

转载于:https://www.cnblogs.com/zhangyu1986love/archive/2009/04/29/1445861.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值