开发者

Asp:Image with Link

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开发者_StackOverflow社区 Is that possible ??


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="..">
   <asp:image id="img" runat="server" imageurl="..." />
</a>


You can add an ImageUrl to a HyperLink.

<asp:HyperLink id="link" runat="server" imageurl="..." />


sure it's possible

<a href="Somepage.aspx"><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


Surround your Image with an anchor tag, like this:

<a href="urlofmypage">
<asp:Image............ />
</a>


you can use ImageButton and on click button do a redirect to the page that you want to go to.


asp:image has own link control. Check it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜