Can anyone help me with this issue.
I only can upload image in PNG format, but when i uplaod an image in JPG or GIF format the grid doesn't show me anything.
I try to convert JPG to PNG but is the same and don't show anything.
Any suggest of how can i do this.
This is my code example:
This is my grid in view:
@(Html.Kendo().Grid<TelerikMvcApp4.Models.PublicacionImagenModel>()
.Name("grid")
.HtmlAttributes(new { style = "height:335px;" })
.Columns(columns =>
{
columns.Template(e => { }).ClientTemplate(" ").Width(140).Title("Imagen").HtmlAttributes(new { style = "height:40px" });
columns.Command(command => command.Destroy()).Width(110);
})
//.AutoBind(false)
.ClientRowTemplate(
"<tr id='a' data-uid='#: uid #'>" +
"<td class='photo'>" +
"<img src='data:image/png;base64,#: imagen64 #' alt='#: data.Puim_clave_pub #' style='width: 180px; height:100px;'/>" +
"</td>" +
"<td style='width:80px'>" +
"<a class='k-button k-button-icontext k-grid-delete'" +
"<span class='k-icon k-delete'></span>Eliminar</a>" +
"</td>" +
"</tr>"
)
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.Puim_clave);
})
.Read(read => read.Action("RowTemplate_Read", "Gestion"))
.Destroy(destroy => destroy.Action("Editing_Destroy_Img", "Gestion"))
)
.Scrollable()
)
And this is the controller action:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Editing_Destroy_Img([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<TelerikMvcApp4.Models.PublicacionImagenModel> expedientes)
{
string sqlDelete = "delete from gmc_publicacion_imagen where puim_clave = :deletePub";
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
OracleConnection con = new OracleConnection(authTicket.UserData.ToString());
OracleCommand cmd = new OracleCommand(sqlDelete, con);
cmd.Parameters.Add(new OracleParameter("deletePub", OracleDbType.NVarchar2));
try
{
con.Open();
Permisos.OtorgarPermisos(con);
//if (expedientes != null && ModelState.IsValid)
//{
foreach (var exp in expedientes)
{
cmd.Parameters["deletePub"].Value = exp.Puim_clave;
cmd.ExecuteNonQuery();
}
//}
}
catch (Exception ex)
{
Session["excepcionGestion"] = ex;
}
finally
{
con.Close();
con.Dispose();
cmd.Dispose();
}
return Json(expedientes.ToDataSourceResult(request, ModelState));
}
I'll wait for your answers. Thanks