这是否可能?我只能设置单元格的背景颜色。问题是,如果我设置了背景颜色,当你打印页面时,它不会显示(默认情况下)。因此,我想通过CSS将背景设置为网格单元格,但在BoundField.ItemStyle类中找不到此属性(仅有'backgroundColor')。那么,这是否可能呢?
提前感谢。
标签。
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
if(condition)//Replace with your condition
{
e.Row.Cells[5].Attributes.Add("Style", "background: url(../Images/test.png) no-repeat 5px center
}
}
}
e.Row.Cells[0].CssClass = "myStyle"
ItemStyle-CssClass="class name here"