Monday, April 25, 2011

GridView Row Color Change Using CSS

First define the css which you want to use. This you could do by defining a seperate css file or by adding the css in the same file. I have declared the css in the same file. The head section of my .aspx file looks like below.

<head runat="server">
    <title>Untitled Page</title>
    <style>
     .RowCss tr:hover
    {
        background-color:Orange;
    }
    </style>
</head>

Next you have to give this css class to the Grid View where you need to change your row.

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
 DataSourceID="SqlDataSource1" CssClass="RowCss" >

Expected Output:

0 comments:

Post a Comment

 

2011 ·Code-Studio by yrus.