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

Sizing of Grid Images

1 Answer 167 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brad Hanson
Top achievements
Rank 1
Brad Hanson asked on 14 Aug 2007, 06:22 PM
Is there anyway that you can allow the images in the gridview control to size to their original size rather than get resized to a much smaller size by the gridview control? I have some images that are 100 px by 100px and I want them to show up in the grid as that size.

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Aug 2007, 01:18 PM
Hi Brad Hanson,

Thank you for the feedback. Unfortunately RadGridView does not support this type of image resize yet. As a workaround I can suggest dynamically turning off image stretching using the following code:

First: You should subscribe to RadGridView CellFormating event:

this.radGridView1.CellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler( this.radGridView1_CellFormatting );

Second: Implement
radGridView1_CellFormatting function

private void radGridView1_CellFormatting( object sender, CellFormattingEventArgs e )
        {
            if (e.CellElement is GridImageCellElement)
            {
                ( e.CellElement as GridImageCellElement ).ImagePosition = Telerik.WinControls.ImagePositions.Center;
            }
        }


Hope that helps.
 

Sincerely yours,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Brad Hanson
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or