protected void gvCatalogo_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Ver") { try { int index = Convert.ToInt32(e.CommandArgument); var colsNoVisible = gvCatalogo.DataKeys[index].Values; string id = colsNoVisible[0].ToString(); string Nombre = colsNoVisible[1].ToString(); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "showNotification", "showNotification('bg-red', '" + Nombre + "', 'bottom', 'center', null, null);", true); objDtoMoldura.PK_IM_Cod = int.Parse(id); objctrMoldura.ObtenerImagen_Desc_Moldura(objDtoMoldura); _log.CustomWriteOnLog("GestionCatalogo", "ID" + id); _log.CustomWriteOnLog("GestionCatalogo", "Descripcion" + objDtoMoldura.VM_Descripcion); _log.CustomWriteOnLog("GestionCatalogo", "VBM_Imagen" + objDtoMoldura.VBM_Imagen); txtDescripcionModal.Text = objDtoMoldura.VM_Descripcion; tituloModal.InnerText = Nombre.ToString(); #region ObtenerImagen string cs = ConfigurationManager.ConnectionStrings["conexion"].ConnectionString; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("SP_GetImageById", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramId = new SqlParameter() { ParameterName = "@Id", Value = id }; cmd.Parameters.Add(paramId); con.Open(); byte[] bytes = (byte[])cmd.ExecuteScalar(); con.Close(); string strbase64 = Convert.ToBase64String(bytes); Image1.ImageUrl = "data:Image/png;base64," + strbase64; } #endregion ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script>$('#defaultmodal').modal('show');</script>", false); } catch (Exception ex) { _log.CustomWriteOnLog("GestionCatalogo", "Error = " + ex.Message + "Stac" + ex.StackTrace); } } }