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

Insert icon on GridViewCommand

2 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Flávio
Top achievements
Rank 1
Flávio asked on 05 Sep 2011, 05:46 PM
Hi,

  I'd like know how to do set a icon on GridViewCommand?
Example attached!

Thanks attention!

2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 08 Sep 2011, 01:28 PM
Hello Flávio,

Thank you for writing.

You should handle the CellFormatting event to achieve the desired functionality. Here is an example:

private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    GridCommandCellElement commandCell = e.CellElement as GridCommandCellElement;
    if (commandCell != null)
    {
        commandCell.CommandButton.Image = Image.FromFile(@"C:\Users\stefanov\Documents\16x16\boldhs.png");
        commandCell.CommandButton.ImageAlignment = ContentAlignment.MiddleCenter;
    }
}

For more information about this event, please refer to the following help article: http://www.telerik.com/help/winforms/gridview-cells-formatting-cells.html.

Greetings,
Stefan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Flávio
Top achievements
Rank 1
answered on 08 Sep 2011, 06:34 PM
Hi Stefan,

   Problem solved!

Thanks attention!
Tags
GridView
Asked by
Flávio
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Flávio
Top achievements
Rank 1
Share this question
or