Gridview单元格的条件格式

本文关键字:格式 条件 单元格 Gridview | 更新日期: 2023-09-27 18:15:48

我有一个gridview,我希望存在于第3行和第6列坐标的单元格作为背景文件image.jpg。我怎样才能做到这一点呢?

Gridview单元格的条件格式

希望对您有所帮助....

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if(e.Row.RowType == DataControlRowType.DataRow)
  {
 if(e.Row.Index=1) //Check your Row index 
  {
      e.Row.Cells[YOur column index].Attributes.Add("Style", "background: url(../Images/nc.png) no-repeat 5px center;");
  }
 }
}