Changing the style of individual cells in a datagridview row

Is it possible to provide individual cells in the row of the data grid view with different styles, such as backcolor, fontcolor, etc.

I do not mean to give the whole line a new style, only a specific cell.

+3
source share
2 answers

of course:

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

+3
source

Something like that?

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 + "‘);");    
  }
}
0
source

Source: https://habr.com/ru/post/1705460/


All Articles