是否可以为数据网格视图行中的单个单元格提供不同的样式,例如背景颜色、字体颜色等?
我不是说给整行一个新样式,只是一个特定的单元格。
是否可以为数据网格视图行中的单个单元格提供不同的样式,例如背景颜色、字体颜色等?
我不是说给整行一个新样式,只是一个特定的单元格。
当然:
Me.myDatagridview.Rows(0).Cells(0).Style.ForeColor = Color.Aqua
像这样的东西?
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 + “‘);”);
}
}