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:{
if(e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Header)
{
e.Item.Attributes.Add("style", "background-image:url('background.gif')");
}
}
1protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
2{
3 if (e.Row.RowType == DataControlRowType.Header)
4 {
5 e.Row.Attributes.Add("style", "background-image:url('background.gif')");
6 }
7}
2{
3 if (e.Row.RowType == DataControlRowType.Header)
4 {
5 e.Row.Attributes.Add("style", "background-image:url('background.gif')");
6 }
7}