0
I’m having trouble displaying an image in my application’s datatable. I get the name of the image but it does not display.
"columns": [
{ "data": "Id", "name": "Id", "autoWidth": true },
{ "data": "Name", "name": "Name", "autoWidth": true },
{ "data": "CPF", "name": "CPF", "autoWidth": true },
{ "data": "City", "title": "City", "name": "ContactName", "autoWidth": true },
{ "data": "Adress", "name": "Adress", "autoWidth": true },
{ "data": "OcupnationName", "name": "OcupnationName", "autoWidth": true },
{
"render": function (data, type, full, meta) {
return '<img src="'+ full.Picture +'" style="width:150px; height:150px;" />';
}
},
{
"render": function (data, type, full, meta) {
return '<a class="btn btn-info" href="/Employee/Details/' + full.Id + '">Info</a>';
}
},
{
"render": function (data, type, full, meta) {
return '<a class="btn btn-info" href="/Employee/AddOrEdit/' + full.Id + '">Edit</a>';
}
},
{
data: null, render: function (data, type, row) {
return "<a href='#' class='btn btn-danger' onclick=DeleteData('" + row.Id + "'); >Delete</a>";
}
},
]
In the
full.Picture
should come alone/Content/Fotos/images.jpg
, the~
should quit because it is not rendered by the server but by javascript. You could try thenfull.Picture.substring(1)
– novic
Thanks was just this blessed "~" even, I did as you said and it worked.
– Cesar Augusto