3

是否可以为数据网格视图行中的单个单元格提供不同的样式,例如背景颜色、字体颜色等?

我不是说给整行一个新样式,只是一个特定的单元格。

4

2 回答 2

3

当然:

Me.myDatagridview.Rows(0).Cells(0).Style.ForeColor = Color.Aqua

于 2009-05-22T15:26:03.083 回答
0

像这样的东西?

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
      string imageName = e.Row.Cells[0].Text.ToString();
      e.Row.Cells[1].Attributes.Add(“Style”,
        “background-image: url(’images/” + imageName + “‘);”);    
  }
}
于 2009-03-27T11:40:13.233 回答