I am trying to open another page from an image. I can open the page on a different window by doing this: onclick="Response.Redirect(cci_info\cci\features\create_CCI\WebForm1.aspx);"

But I don't want to open another window, rather I need the image button to open a page in the same window.

Thanks for the help.

<asp:image imageurl="~/common/images/demos/header-buildsummary.png" width="125" height="34" alternatetext="CCI Form" runat="server" cssclass="site"
id="cciform" onmouseover="this.src='common/images/demos/header-cciform-hover.png';"
onmouseout="this.src='common/images/demos/header-cciform.png';"
onclick="Response.Redirect(cci_info\cci\features\create_CCI\WebForm1.aspx);" title="Test - CCI"TabIndex="1"/>

You want the image button to open the page in the same window (i.e. without launching a new IE browser?)?

Correct. Just like if you click on the"IRC Chat Network" image to the right of you screen. It will open the link on the same window.

You want the image button to open the page in the same window (i.e. without launching a new IE browser?)?

I messed up on the problem detail. I was able to open up another form but in a new window by doing this: onclick="window.open('WebForm/UCOSQA','_blank');" But I just want to open the form on the same window. The above window.open will open another window.

onclick="Response.Redirect(pagetogoto.aspx);"

Should do the trick. If not let me know and post your code. Hope that helps!

onclick="Response.Redirect(pagetogoto.aspx);"

Should do the trick. If not let me know and post your code. Hope that helps!

I tried that but got no response from clicking.

Show me the complete code, it may be a slight error somewhere. That should work.

Actually, create an event handler for the image (by double clicking it in Visual studio) then in the event handler try this:

Response.Redirect("pagetogoto.aspx");

Or for Visual Basic

Response.Redirect("pagetogoto.aspx")

This should fix it. Hope this helps!

Actually, create an event handler for the image (by double clicking it in Visual studio) then in the event handler try this:

Response.Redirect("pagetogoto.aspx");

Or for Visual Basic

Response.Redirect("pagetogoto.aspx")

This should fix it. Hope this helps!

<%@ Page Language ="C#"%>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    
   
</script>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head id="Head1" runat="server">
    <title>UCOSQA - Home</title>
    <link href="common/css/rotator.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="common/css/demos.css" />
    <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="common/css/ie6-demos.css" /><![endif]-->
</head>
<body>
    <form id="form1" runat="server">
<!-- Body Container -->
<div id="body-container">

	<!-- Header Container -->
	<div id="header-container">

		<!-- Header Navigation -->
		<div id="header">
			<asp:image imageurl="~/common/images/demos/header-logo.png" width="121" height="34" alternatetext="ComponentArt" runat="server" cssclass="logo" id="ca_logo" />
			<asp:image imageurl="~/common/images/demos/header-divider.png" width="35" height="34" alternatetext="|" runat="server" cssclass="divider" id="divider" />
			<asp:image imageurl="~/common/images/demos/header-title.png" width="188" height="34" alternatetext="Web.UI 2007.1 Live Demos" runat="server" cssclass="demo-title" id="demo_title" />
			<asp:image imageurl="~/common/images/navigation/separator.png" width="353px" 
                height="34px" alternatetext=" " runat="server" cssclass="separator" 
                id="separator" />
			<asp:image imageurl="~/common/images/demos/header-buildsummary.png" width="125" 
                height="34" alternatetext="UCOS QA - Build Summary" runat="server" 
                cssclass="site" id="buildsummary"  
                onmouseover="this.src='common/images/demos/header-buildsummary-hover.png';" 
                onmouseout="this.src='common/images/demos/header-buildsummary.png';" 
                onclick="window.open('WebForm/UCOSQA','_blank');" title="UCOSQA - Build Summary" />
			<asp:image imageurl="~/common/images/demos/header-cciform.png" width="125" 
                height="34" alternatetext="CCI Form" runat="server" cssclass="site" 
                id="cciform" 
                onmouseover="this.src='common/images/demos/header-cciform-hover.png';" 
                onmouseout="this.src='common/images/demos/header-cciform.png';" 
                onclick="Response.Redirect(copyofdefault.aspx);" title="UCOSQA - CCI Form" 
                TabIndex="1"/>
		</div>

Did you try what I suggested in post 8 - it should work ! :)

Did you try what I suggested in post 8 - it should work ! :)

I did I added: onclick="Response.Redirect(copyofdefault.aspx);" I got no response from clicking the image.

Did you put it in the event handler of the image button in the code behind file? I have tested it myself and got it working this end. It should look something like this:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Response.Redirect("copyofdefault.aspx")
    End Sub
End Class

Replace ImageButton1_Click with the name of you ImageButton_Click. That code needs to be in the code behind on the same page as your image button. Hope that makes sense and fixes your problem! :)

Did you put it in the event handler of the image button in the code behind file? I have tested it myself and got it working this end. It should look something like this:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Response.Redirect("copyofdefault.aspx")
    End Sub
End Class

Replace ImageButton1_Click with the name of you ImageButton_Click. That code needs to be in the code behind on the same page as your image button. Hope that makes sense and fixes your problem! :)

I did that but its the same. It is not really an imagebutton but an image. When I tried clicking on the image in Visual Web Developer it should take me to a Button_Click event function, but it took me to the .vb page only. If I add a regular button, it would work.

Did you try what I suggested in post 8 - it should work ! :)

I am using this:

<asp:img

Not this.

<asp:ImageButton

What is the difference between the two?

Sorry I thought you were using an imagebutton. Try using an ImageButton instead, as I suggested above. it will work I have tested it. :) Hope this fixes it.
1- An image button is a control that displays an image and responds to mouse clicks on the image.
2- An image control is just used to display an image.

Hope that helps you, please mark thread as solved when you get it working! :)

Hi, I know that this thread is old but I had the same problem, found the solution and now I am writing.

The problem happens in IE, and what you must heve done is this:

1. your page header should look like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SomePage.aspx.cs"
Inherits="SomePage" %>
----- If you have here some tag like this: SmartNavigation="true" , REMOVE IT.

2. you shoud put this tag in the <head> of your html:
<base target="_self" />

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.