• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
.NET新手入门
Keep MOVEing.......永不止步!!!
博客园    首页    新随笔    联系   管理    订阅  订阅

为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;
}
posted @ 2009-04-29 09:11  .NET新手入门  阅读(1079)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3