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

load the grid with images from the database

3 Answers 411 Views
Grid
This is a migrated thread and some comments may be shown as answers.
charan
Top achievements
Rank 1
charan asked on 29 May 2012, 12:52 PM
hi,
I have a table in mysql with an Image field.I have the images in my database.I am able to load the remaining data dynamically except the image field.I used like { field: "Image", title: "image",template:"<img src ='#=Image #'/>"},but i didn't get the image in grid.can u tell me how to load the images into the grid.

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 29 May 2012, 01:27 PM
Hi Charan,

The approach that you are using seems to be correct and the information that you provided is not sufficient enough to detect what is causing the issue. Could you please confirm that the field: "Image" contains a valid image URL? Is it possible to provide a sample of the Json returned by your server?

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
charan
Top achievements
Rank 1
answered on 05 Jun 2012, 05:51 AM
i used linq query to get the data from the database.i am able to display the data from database except the image field.my query is
 public ActionResult Get()
        {
             var query = (from i in dbContext.Personaldetails
                         select new
                         {
                            Image =  i.Image,
                             }).ToArray();
           return Json(query, JsonRequestBehavior.AllowGet);
        }
In the image field it is displaying the bytes value,if i didnot mention the image template
                                   template:"<img src ='#=Image #'/>"
If i mention this template it is displaying an image symbol with cross mark.but not displaying the image.
Any suggestions.....
0
Alexander Valchev
Telerik team
answered on 05 Jun 2012, 01:38 PM
Hi Charan,

I am afraid that it is a bit unclear what data your server is returning. Could you please specify what do you mean by "bytes value"? The src attribute of the img tag specifies the URL of an image, the cross mark symbol is usually displayed when the browser failed to load the resource (image file).

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
charan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
charan
Top achievements
Rank 1
Share this question
or