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

GridView cell background image

1 Answer 75 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jamie
Top achievements
Rank 2
Jamie asked on 21 Mar 2014, 05:43 PM
Please could someone let me know if it is possible to have a background image set to a specific cell on every row, but to also have a label/TextBoxCell in that cell too?

Any examples would be great.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Mar 2014, 02:36 PM
Hello Jamie,

Thank you for contacting Telerik Support.

It is possible to apply an image to a specific cell for each row via the CellFormatting event:
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.Column.Name == "ProductName")
    {
        e.CellElement.Image = Properties.Resources.refresh;
        e.CellElement.ImageLayout = ImageLayout.Zoom;
        e.CellElement.TextImageRelation = TextImageRelation.Overlay;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.ImageProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.ImageLayoutProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.TextImageRelationProperty, ValueResetFlags.Local);
    }
}

Please refer to our Formatting Cells help article about this topic.

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Desislava
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Jamie
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or