1) Add a template field for gridview.
<asp:TemplateField>
<HeaderTemplate>Picture</HeaderTemplate>
<ItemTemplate>
<img border="1" src="images/cursor.jpg" onerror="this.src=images/error.jpg" onload="RetrievePicture(this,'<%# Eval("pic_id")%>');"/>
</ItemTemplate>
</asp:TemplateField>
2) Javascript function to call.
<script type="text/javascript" language="javascript">
function RetrievePicture(imgCtrl, picid)
{
imgCtrl.src = 'ShowImage.ashx?id=' + picid;
}
</script>
No comments:
Post a Comment