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

Change icon in commandcolumn when adding new row

1 Answer 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Armen
Top achievements
Rank 1
Armen asked on 26 Aug 2010, 04:29 AM
Hi. I'am using telerik winform q2 2010 with visual studio 2008. I have gridview that allowed to add new row, also I haveGridViewTextBoxColumns and GridViewCommandColumn with image. When I click to add new row i want to change GridViewCommandColumn image in this row. When I handle grid_CellClick event i can get GridViewCellInfo object of this commandColumn but it doesn't allow me to change image. How can I solve this?

Thank you.
Regards, Armen. 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 31 Aug 2010, 10:56 PM
Hello Armen,

Thank you for the question.

Such kind of customizations should be applied in the CellFormatting event. Please refer to the code snippet below, it demonstrates how to change the image of a button in GridViewCommandColumn if the row containing the button is the new row:
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
  
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.RowInfo is GridViewNewRowInfo &&
        e.CellElement.ColumnInfo is GridViewCommandColumn)
    {
        ((RadButtonElement)e.CellElement.Children[0]).Image = WindowsFormsApplication1.Properties.Resources.Chrysanthemum;
    }
}

I hope this helps.

Best wishes,
Nikolay
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
Armen
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or