Monday, June 11, 2012

How to view full image in asp.net


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function DisplayFullImage(ctrlimg)
{
txtCode = "<HTML><HEAD>"
+ "</HEAD><BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0><CENTER>"
+ "<IMG src='" + ctrlimg.src + "' BORDER=0 NAME=FullImage "
+ "onload='window.resizeTo(document.FullImage.width,document.FullImage.height)'>"
+ "</CENTER>"
+ "</BODY></HTML>";
mywindow= window.open ('','image', 'toolbar=0,location=0,menuBar=0,scrollbars=0,resizable=0,width=1,height=1');
mywindow.document.open();
mywindow.document.write(txtCode);
mywindow.document.close();
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" BorderColor="black" BorderWidth="1px"
width="200px" height ="200px" runat="server"
ImageUrl = "Sunset.jpg" onclick="DisplayFullImage(this);"/>

</div>

</form>
</body>
</html>

No comments:

Post a Comment