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

Displaying a jpeg file in a RadGrid

8 Answers 276 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Steve Stilwell
Top achievements
Rank 1
Steve Stilwell asked on 20 Oct 2009, 03:18 AM
I downloaded the trial version of the ASP.NET controls to see if they would work for a project I am about to start.  What I need to do is to display a date, some text, and an image about the text from a jpg file.  Our database contails a column with the name of the jpg (e.g., image1.jpg).  In the Gridview I was able to set it up to display the photo but I have not been able to figure out how to configure the RadGrid control to display the jpeg.  Any suggestions?

Thanks.

- Steve

8 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 20 Oct 2009, 08:54 AM
Hello Steve,

In order to achieve the desired functionality I suggest you review the following online demo:
Binary Images and Upload in Grid
This example illustrates the usage of built-in GridBinaryImageColumn and how to display and edit images in it.

I hope this helps.

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Steve Stilwell
Top achievements
Rank 1
answered on 20 Oct 2009, 03:16 PM
Thanks Pavlina.

I think that means of displaying the photo is a bit different from what we had hoped to do.  We would prefer not to load the photo into the database but rather just have the database point to the jpeg file.  I was able to do that in Gridview.  Would I also be able to do that with RadGrid or some other Grid control (we need to display hierarcial data in the grid so I was thinking I would need the RadGrid).

Thanks again.

- Steve
0
Sebastian
Telerik team
answered on 20 Oct 2009, 04:06 PM
Hello Steve,

Thank you for the clarification. For this purpose you can use the built-in GridImageColumn presented on this online demo of the product:

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx

It is equivalent to the ImageField in the standard MS GridView control.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Steve Stilwell
Top achievements
Rank 1
answered on 20 Oct 2009, 05:11 PM
Thanks.  That seems to be getting things a little closer.  I now have something like this in my ASP page:

 

<telerik:GridImageColumn DataType="System.String" HeaderText="ImageLocation" DataImageUrlFields="ImageLocation"

 

 

ImageAlign="Middle" ImageHeight="100"

 

 

DataImageUrlFormatString="~/{0}.jpg" UniqueName="ImageLocation">

 

 

</telerik:GridImageColumn>

 

For the first record the value in ImageLocation is:
    ~/guyser_DSC0069.jpg

Which is the name of a jpeg file in the root of the web.  I added the column with the ImageLocation as just a string column so I can see it is getting it ok, but in the GridImageColumn i just a box where the image would go but no image.  There is also a smaller box in the box with a red X in it.  Any suggestion on what I need to do to get the image to display?

Thanks again.
0
Sebastian
Telerik team
answered on 21 Oct 2009, 09:18 AM
Hello Steve,

It seems that the images paths are not resolved properly in your case. Can you check whether removing the "~/" part from the DataImageUrlFormatString property value produces the desired result? On the online example I referenced the images reside in IMG sub-folder, see how their url format string is defined for reference.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Steve Stilwell
Top achievements
Rank 1
answered on 21 Oct 2009, 12:05 PM
It was my fault.  I had forgotten to copy the photos to this site.  I did and now it works great.  Thanks again.
0
Jack
Top achievements
Rank 1
answered on 02 Feb 2014, 07:15 PM
Hello,
I downloaded the trial and I'm trying to display image in my radgrid.
somehow I couldn't manage to do it no matter what I did.

my table includes a column named "picture". and in the cell of the first row of picture there is a bag.jpg value.

the jpg file i mention above is in IMG folder.

and here is my code:

                <telerik:GridImageColumn DataImageUrlFields="picture"
                    DataImageUrlFormatString="IMG/{0}.jpg" HeaderText="picture" ImageHeight=""
                    ImageWidth="" SortExpression="picture" UniqueName="picture">
                </telerik:GridImageColumn>

I don't see any picture when I run the code. can you please help?
0
Jack
Top achievements
Rank 1
answered on 02 Feb 2014, 07:52 PM
I handled the problem. It's really weird that you can't see the image no matter what when you're in debugging. but when you go live, they appear perfectly.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Steve Stilwell
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Steve Stilwell
Top achievements
Rank 1
Sebastian
Telerik team
Jack
Top achievements
Rank 1
Share this question
or