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

Adding images to popup templete

2 Answers 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LUIS
Top achievements
Rank 1
LUIS asked on 28 Jan 2013, 03:09 PM
Hello,

Is possible show a data base image (for example product photo) to a grid's popup template 
I try Try this in my editor template view, but id is always 0:
<img src='@Url.Action( "ShowFoto", "Pacientes", new {id = Model.Id} )' />
The controller action is:

public ActionResult ShowFoto(int id)
{
    var imageData = _db.Pacientes.Find(id).Foto;
 
    if (imageData != null)
    {
        return File(imageData, "image/jpg");
    }
    return null;
}
Another question is how to add a new image from the template popup window?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 30 Jan 2013, 08:57 AM
Hi Luis,


To render field from the model in the PopUp template you can use the following syntax:

Example of rendering "OrderID" field:
<img src='@Url.Action("RenderPhoto", "Home", new { id = "${OrderID}" }, @Request.Url.Scheme)' />

The "${OrderID}" will be replaced with the corresponding value from the model when the template is executed.

Kind regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
LUIS
Top achievements
Rank 1
answered on 01 Feb 2013, 04:45 PM
Thank you Vladimir. It works perfect!
Tags
Grid
Asked by
LUIS
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
LUIS
Top achievements
Rank 1
Share this question
or