Reputation: 23321
Is it possible to give individual cells in a data grid view row different styles such as backcolor, fontcolor etc?
I do not mean giving the whole row a new style, only a specific cell.
Upvotes: 3
Views: 19661
Reputation: 18746
certainly:
Me.myDatagridview.Rows(0).Cells(0).Style.ForeColor = Color.Aqua
Upvotes: 3
Reputation: 359
Something like this?
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 + “‘);”);
}
}
Upvotes: 0