GridView CSS的樣式表

來源:互聯網
上載者:User
2008-08-19 16:36

在<head></head>標籤中加入一個樣式表,並定義它.

<style type="text/css">
                    .GridViewStyle
               {  
                    border-right: 2px solid #A7A6AA;
                    border-bottom: 2px solid #A7A6AA;
                    border-left: 2px solid white;
                    border-top: 2px solid white;
                    padding: 4px;
                }

                .GridViewStyle a
                {
                    color: #FFFFFF;
                }

                .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 td
                {
                    border: 1px solid #EBE9ED;
                }

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

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

                .GridViewPagerStyle table /**//* to center the paging links*/
                {
                    margin: 0 auto 0 auto;
                }
    </style>

這時一個完整的對gridView的樣式表就已經定義完成了.現在來實現它的應用

<asp:GridView CssClass="GridViewStyle" runat="server" >
    <FooterStyle CssClass="GridViewFooterStyle" />
    <RowStyle CssClass="GridViewRowStyle" />   
    <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
    <PagerStyle CssClass="GridViewPagerStyle" />
    <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
    <HeaderStyle CssClass="GridViewHeaderStyle" />
</asp:GridView>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.