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

[Solved] image from database (byte[])

2 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 02 Apr 2012, 08:15 PM
Hi,

I need to display in @(Html.Telerik().Grid... (razor) an image from the database (byte[] field type).

Any idea?

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Apr 2012, 02:29 PM
Hi,

 Telerik Grid for ASP.NET MVC does not support this out of the box. You can however check this stackoverflow topi discussing the same: http://stackoverflow.com/questions/880515/display-image-from-database-in-asp-mvc 

Greetings,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Louis
Top achievements
Rank 1
Iron
Iron
Iron
answered on 03 Apr 2012, 03:59 PM
A BIG thank you Atanas,

I use this and it's work #1 :

in the view :

columns.Bound(c => c.NoEquipement).ClientTemplate(

"<img width='70' border='1' alt='<#= NoEquipement #>' src='" + @Url.Action("GetImage", "Equipements", new { id ="<#=NoEquipement#>" }) + "' />");

in the controller :

        [HttpGet]
        public FileContentResult GetImage(int id)
        {
            ...
        }


Have nice day.



Tags
Grid
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Atanas Korchev
Telerik team
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or