Skip to main content

How To Make Clickable image

The Image Web server control is used to display an image on a Web page. To set the image to be displayed for this control we use the ImageUrl property.In this post i will show how to make Clickable image .(Unfortunately image control not supports NavigateUrl )

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>Untitled Page</title>
</head>
<body>
   <form id="form1" runat="server">
       <asp:ScriptManager ID="ScriptManager1" runat="server" />
       <div>
           <a id="link1" runat="Server">
               <asp:Image ID="SlideShowImage1" CssClass="crop" runat="server" Width="630px" Height="192px" />
           </a>
       </div>
   </form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
      SlideShowImage1.ImageUrl = "sunset.jpg";
      link1.HRef = "http://www.aspdotnetcodebook.blogspot.com";
      link1.CausesValidation = false;
      link1.Target = "_blank";
   

  }
}

Comments

Popular posts from this blog