EasyUI 读数据库图

EasyUI 读数据库图

      function edit_dg() {
            //选中一行,获取这一行的主键值
            var idImg = $("#tbDeviceClassBrowstab").datagrid('getSelected').pid;
             $("#imgId").attr("src", "/ashx/Device/tbDeviceClass.ashx?action=image&pid=" + idImg);
     <td style=" padding:5px; " colspan="1" rowspan="8" >
                      <img id="imgId" alt="图片" border=0 align="middle"  src=""  width="200" height="200"> </img>
                   </td>

后台:

                byte[] imagebytes = null;
                imagebytes = (byte[])dtimg.Rows[0]["DevImage"];
                HttpContext.Current.Response.ContentType = "image/jpeg";
                HttpContext.Current.Response.BinaryWrite(imagebytes);
原文地址:https://www.cnblogs.com/yimeishui/p/5979284.html