Home > DeveloperSection > Forums > Redirect from the Image Button
Chintoo Semi

Total Post:135

Points:947
Posted on    September-20-2014 2:32 AM

 ASP.Net .NET  ASP.Net  C# 
Ratings:


 1 Reply(s)
 637  View(s)
Rate this:

I want to link a button to this website “http://www. timesofindia.indiatimes.com/” When the user clicks the image button. I have searched on the net and can't find an exact solution. This is what I have so far

<asp:ImageButton ID="ImgButtonTimesOfIndia" runat="server" ="~/Images/TimesOfIndia.png" Width="480px"/>



Anchal Kesharwani
Anchal Kesharwani

Total Post:10

Points:70
Posted on    September-20-2014 2:51 AM

hi Chintoo,

You  can use this code. I hope that it works for you.

Either use the postback url

 

<asp:ImageButton ID="ImgButtonTimesOfIndia" runat="server" ImageUrl="~/Images/TimesOfIndia.png"  PostBackUrl="http://www.timesofindia.com/" Width="480px" />

 

Or

 

ASPX Code

 

<asp:ImageButton ID="ImgButtonTimesOfIndia" runat="server" ImageUrl="~/Images/TimesOfIndia.png" Width="480px" OnClick="ImgButtonTimesOfIndia_Click"/>

 

 cs file code

 

protected void ImgButtonTimesOfIndia_Click(object sender, ImageClickEventArgs e)

   {

       Response.Redirect("http://www.timesofindia.com/");

 

   }


Don't want to miss updates? Please click the below button!

Follow MindStick