GridView中对表头设定背景图片
后台实现方法:
Code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Attributes.Add("style", "background-image:url('background.gif')");
}
}
前台实现方法:
HTML code
Code
<asp:GridView runat="server" ID="gvStatList" AllowPaging="false" Width="100%" CssClass="grid"
AutoGenerateColumns="false" Visible="true" ShowFooter="false">
<HeaderStyle CssClass="grid-head" />
</asp:GridView>
CSS code:
Code
.grid-head {
font-size: 14px;
font-weight: normal;
color: #FFFFFF;
background-image: url(../images/grid-bg.gif);
text-align:center;
vertical-align:middle;
height: 28px;
}
posted @
2008-08-30 23:48
aito
阅读(
570)
评论()
编辑
收藏
举报