I would like to place an image in my application. when I click on it I want to move to another page. In general my asp:image to work as link
Is that possible ??
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can use an ImageButton with a server side click event:
Response.Redirect("SecondPage.aspx");
Or alternatively, you could wrap a Hyperlink control around the Image control:
<asp:hyperlink id="link" runat="server"> <asp:image id="img" runat="server" imageurl="..." /> </asp:hyperlink>
Or just use a HTML anchor tag if you don’t need the link to be dynamic:
<a href=".." rel="nofollow noreferrer noopener"> <asp:image id="img" runat="server" imageurl="..." /> </a>
Method 2
You can add an ImageUrl to a HyperLink.
<asp:HyperLink id="link" runat="server" imageurl="..." />
Method 3
sure it’s possible
<a href="Somepage.aspx" rel="nofollow noreferrer noopener"><asp:Image id="Image1" runat="server" /></a>
Or if you want code-behind to handle which page you’re linking to use asp:ImageButton
<asp:ImageButton id="ImageButton1" runat="server" />
and handle the click event in your code-behind
Method 4
Surround your Image with an anchor tag, like this:
<a href="urlofmypage" rel="nofollow noreferrer noopener"> <asp:Image............ /> </a>
Method 5
you can use ImageButton and on click button do a redirect to the page that you want to go to.
Method 6
asp:image has own link control. Check it.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0