All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
在DataGrid和GridView中对表头设定背景图片_[Asp.Net教程]

Writer: delv Article type: Programming skills(编程技巧) Time: 2014/1/24 9:15:42 Browse times: 344 Comment times: 0

在DataGrid和GridView中对表头设定背景图片_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

在DataGrid和GridView中对表头设定背景图片_[Asp.Net教程]

在某些情况下,DataGrid或者GridView的默认样式并不能满足日益高涨的用户的要求,很多人追求美观的样式。对表头设定背景也是其中的一个方面,那么有什么好的方法可以达到这一要求呢,我的方法如下:
DataGrid:
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Header)
{
e.Item.Attributes.Add("style", "background-image:url('background.gif')");
}
}

GridView:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Attributes.Add("style", "background-image:url('background.gif')");
}
}





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.