Help with ImageButton

Discussion in 'C#' started by aff_newbie, Feb 3, 2007.

  1. #1
    I am rather new to ASP and would like some help on how to create an ImageButton where I can hide where I am redirecting my customers to.

    I know how to do this with the LinkButton. I've got some code written where in my default.aspx I have defined the LinkButton and in my aspx.vb file I have this:

    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click
    Response.Redirect("http://blah blah blah.com")

    End Sub

    How do I get the same effect with an image button?

    Thank you so much to all who can help me! It is an urgent matter... thanks again!
     
    aff_newbie, Feb 3, 2007 IP
  2. TasteOfPower

    TasteOfPower Peon

    Messages:
    572
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    
    Sub ImageButton_Click(sender As Object, e As ImageClickEventArgs) 
             // blah
    End Sub
    
    
    
    Code (markup):

    dont forget your handles part.
     
    TasteOfPower, Feb 4, 2007 IP
  3. n000b1t4

    n000b1t4 Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Image Button doesn't have Handles part, instead it has OnClick attribute.

    View example below :

    i.e. you have code below in your .aspx :
    <asp:ImageButton id="btnUpload" onclick="btnUpload_Click" runat="server" ImageUrl="~/Images/upload.png" ImageAlign="AbsBottom" __designer:wfdid="w33"></asp:ImageButton>

    so, inside .vb you should have :
    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
    ' Save file here
    End Sub

    By double clicking an imagebutton on designer mode, you should have it automatically.
    Hope this help..
     
    n000b1t4, Aug 15, 2008 IP
  4. gramyla

    gramyla Peon

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it will show you automatically on default.aspx while you doubleclick on that image button
    you just have to insert a coding of your effect which you want to apply.
     
    gramyla, Aug 30, 2008 IP