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

Databound event

1 Answer 179 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Geert
Top achievements
Rank 1
Geert asked on 30 Jun 2010, 01:34 PM
Hello,

I have a grid with a datasource containing a dataset.  In this dataset there is a field which contains a variable parameter

I have to check this parameter and set an image in an imagecolumn. The image is delivered to me in a base64string.

Everything works, but I can't find which event to take for this action.
Every time a row is bounded to the datagrid the action has to take place...

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 02 Jul 2010, 04:36 PM
Hello Geert,

Thank you for your question.

You can use the CellFormatting event to populate the image column. Please consider the following code snippet as an example:

private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.ColumnIndex == indexOfImageColumn && !(e.CellElement.RowIndex < 0))
    {
        GridViewCellInfo paramCell = this.radGridView1.Rows[e.CellElement.RowIndex].Cells[indexOfParamColumn];
        GridViewCellInfo imageCell = this.radGridView1.Rows[e.CellElement.RowIndex].Cells[e.CellElement.ColumnIndex];
        
        // check value of the parameter cell
        // set the corresponding image to the image cell
    }
}

I hope it helps.

Best wishes,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Geert
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or