New to Telerik UI for WinForms? Download free 30-day trial

Images

RadGridView displays several images to indicate the status of a row:

  • CurrentRowHeaderImage: Image to indicate the current row.

  • EditRowHeaderImage: Image to indicate when RadGridView is in edit mode.

  • ErrorRowHeaderImage: Image to indicate an error caused on validation.

  • NewRowHeaderImage: Image to indicate the new row.

Changing the images programmatically

You can change the images using the properties shown below:

Changing the current row image

((GridTableElement)this.radGridView1.TableElement).CurrentRowHeaderImage = Image.FromFile("..\\..\\DataSources\\separator.gif");
((GridTableElement)this.radGridView1.TableElement).EditRowHeaderImage = Image.FromFile("..\\..\\DataSources\\edit.png");
((GridTableElement)this.radGridView1.TableElement).ErrorRowHeaderImage = Image.FromFile("..\\..\\DataSources\\error.png");
((GridTableElement)this.radGridView1.TableElement).NewRowHeaderImage = Image.FromFile("..\\..\\DataSources\\star.png");

DirectCast(Me.RadGridView1.TableElement, GridTableElement).CurrentRowHeaderImage = Image.FromFile("..\\..\\DataSources\\separator.gif")
DirectCast(Me.RadGridView1.TableElement, GridTableElement).EditRowHeaderImage = Image.FromFile("..\\..\\DataSources\\edit.png")
DirectCast(Me.RadGridView1.TableElement, GridTableElement).ErrorRowHeaderImage = Image.FromFile("..\\..\\DataSources\\error.png")
DirectCast(Me.RadGridView1.TableElement, GridTableElement).NewRowHeaderImage = Image.FromFile("..\\..\\DataSources\\star.png")

Setting an image in a column header

The following code snippet demonstrates how to set an image for a certain column:

Set an image in a column header

radGridView1.Columns["Date"].HeaderImage = Image.FromFile("..\\..\\DataSources\\star.png");
radGridView1.Columns["Date"].TextImageRelation = TextImageRelation.ImageAboveText;

RadGridView1.Columns("Picture Name").HeaderImage = Image.FromFile("..\\..\\DataSources\\star.png")
RadGridView1.Columns("Picture Name").TextImageRelation = TextImageRelation.ImageAboveText

See Also

In this article