Ngày đăng: 15:03:16 23-08-2011
File CSS Cho GridView
/*Chinh Màu cho các dòng*/
.mGrid tr.row
{
background:#e8fbfb;
height:30px;
}
/*Chỉnh Hover cho từng dòng*/
.mGrid tr.row:hover
{
background:#fff7c0;
width:100%;
}
/*Chỉnh hover cho từng ô*/
.mGrid td:hover
{
background:#88fe9c;
}
/*Chỉnh ô sửa ,xóa*/
/*Header and Pager styles*/
.HeaderStyle, .PagerStyle /*Common Styles*/
{
background-position:center;
background-repeat:repeat-x;
background:#56d0f3;
}
.HeaderStyle th
{
padding: 5px;
color: #ffffff;
}
.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 3px solid;
}
.PagerStyle a
{
color:#ffffff;
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:red;
text-decoration:none;
padding:2px 10px 2px 10px;
border-top:solid 1px red;
border-right:solid 1px red;
border-bottom:solid 1px red;
border-left:solid 1px red;
background:white;
}
Chèn code màu đỏ vào GridView
<asp:GridView CssClass="mGrid">
<PagerStyle CssClass="PagerStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<Columns>
.......
</Columns>
</asp:GridView>
Sau đó Chọn Control GridView và chuột phải vào properties/Event/ Click vào RowCreated
Viết mã cho RowCreated
if (e.Row.RowType == DataControlRowType.DataRow)
e.Row.CssClass = "row";