This is a migrated thread and some comments may be shown as answers.

Showing an image for a new row

1 Answer 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 19 Dec 2008, 11:39 AM
Hi,
I would like to show an image on a row, but only if it's a new row, is this possible?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 19 Dec 2008, 03:39 PM
Hello Derek,

You can do this by using the Tag property of GridViewRowInfo. Just set it to some value when processing the DefaultValuesNeeded method and check it when processing the CellFormatting event. Take a look at the sample below:

this.radGridView1.Columns.Add(new GridViewImageColumn("Image")); 
 
this.radGridView1.DefaultValuesNeeded += new GridViewRowEventHandler(radGridView1_DefaultValuesNeeded); 
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting); 
 
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.ColumnInfo.HeaderText == "Image" && e.CellElement.RowInfo.Tag != null
    { 
        e.CellElement.Image = Resources.blue; 
    } 
 
void radGridView1_DefaultValuesNeeded(object sender, GridViewRowEventArgs e) 
    e.Row.Tag = "new"
 

I hope this helps. Do not hesitate to contact me if you need further assistance.

All the best,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or