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
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
or do whats above with onmousover so the user doest even need to click the image :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Create a new page "imageViewer.aspx". Put this in the .aspx :
<head runat="server"><title></ti tle>
<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.a spx?path=" + iPath,"winOne","height=630 ,width=680 ,status=ye s,toolbar= no,menubar =no,locati on=no,top= 90,left=12 0,resizabl e=yes,scro llbars=yes ");}
</script>
<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/0000266 _0.jpg" runat="server"
OnClientClick="oWin('~/ima ges/000026 6_0.jpg')" />
You can adjust the size of the page and location by changing the parameters in the oWin function.
<head runat="server"><title></ti
<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.a
</script>
<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/0000266
OnClientClick="oWin('~/ima
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" )
}
protected void Page_Load(object sender, EventArgs e)
{
imgName.ImageUrl = Request.QueryString("path"
}
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!
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!
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 :)