Link to home
Start Free TrialLog in
Avatar of Wildone63
Wildone63

asked on

VB.Net Image button

I have an aspx page with an image button
I set the image property of the image button to a small version of a picture.\

When someone clicks this button I want to display the full sized image in a new window.

Can someone please show me how to do this.

Thank You
Avatar of plusone3055
plusone3055
Flag of United States of America image

simplier way to do this is to take the original image lets say its 150 X 150
and make a copy of it
and resize it to the small version
so image1.job is 75 X 75
and onclick you display.true the original image 150 X 150

easy as pie :)



or do whats above with onmousover so the user doest even need to click the image :)

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Create a new page "imageViewer.aspx". Put this in the .aspx :

<head runat="server"><title></title>

<script language="javascript" type="text/javascript">
    function closewindow() {
        window.close()
    }
</script>
</head>

<body>
<form id="form1" runat="server">
<table width="100%">
<tr>
<td align="center">

<asp:Image runat="server" id="imgName" />
</td></tr>

<tr>
<td align="center"><br />
<input type="button" value="Close Window" onclick="closewindow()" />
</td></tr></table>
</form>

</body>

This in the code-behind :

 protected void Page_Load(object sender, EventArgs e)
        {
            imgName.ImageUrl = Request.QueryString["path"];

        }



Put this in your .aspx page that has the button :


<script language="JavaScript">
function oWin(iPath)
{newWin = window.open("imageViewer.aspx?path=" + iPath,"winOne","height=630,width=680,status=yes,toolbar=no,menubar=no,location=no,top=90,left=120,resizable=yes,scrollbars=yes");}
</script>


<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/0000266_0.jpg"  runat="server"
 OnClientClick="oWin('~/images/0000266_0.jpg')"  />

You can adjust the size of the page and location by changing the parameters in the oWin function.
you're using VB, so this instead :

protected void Page_Load(object sender, EventArgs e)
        {
           imgName.ImageUrl = Request.QueryString("path")  
        }


Avatar of Wildone63
Wildone63

ASKER

All of the answers were good.

I chose this one because it was very easy to use and had some additional benefits.

I had to purchase the java but it was 29.00. Very good deal!