The following snippet below will display the original Image size in new window when clicking on the image thumbnail using JavaScript..

JAVASCRIPT FUNCTION

<script type="text/javascript" language="javascript">
    function DisplayNewImageInWidnow()
    {
       var img = document.getElementById('<%= Image1.ClientID %>').src;

        html = "<HTML><HEAD><TITLE>Photo</TITLE>"
        +  "</HEAD><BODY LEFTMARGIN=0 "  
        + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>"  
        + "<IMG src='"
        + img
        + "' BORDER=0 NAME=image "  
        + "onload='window.resizeTo(document.image.width,document.image.height)'>" 
        + "</CENTER>"  
        + "</BODY></HTML>";
        popup= window.open  ('','image',  'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
        popup.document.open();
        popup.document.write(html);
        popup.document.focus();
        popup.document.close();
}

</script>

ASPX Image Control MARKUP

<asp:Image ID="Image1" width="100px" height ="100px"  runat="server" ImageUrl = "Images/PublicPrivateChart.gif" onclick="DisplayNewImageInWidnow();"/>

Happy Coding!

Technorati Tags: ,,