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" "">
<html xmlns="">
<head runat="server">
   <title>Untitled Page</title>
   <form id="form1" runat="server">
       <asp:ScriptManager ID="ScriptManager1" runat="server" />
           <a id="link1" runat="Server">
               <asp:Image ID="SlideShowImage1" CssClass="crop" runat="server" Width="630px" Height="192px" />
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 = "";
      link1.CausesValidation = false;
      link1.Target = "_blank";


Post a Comment


Close Menu