ImageButton Event Not Firing

Results 1 to 2 of 2

Thread: ImageButton Event Not Firing

  1. #1
    Join Date
    Dec 1969

    Default ImageButton Event Not Firing

    I have an array of ImageButtons that I add to a table. I bind an event to handle when it&#039;s clicked, but it won&#039;t fire:<BR><BR>Dim img(1000) As System.Web.UI.WebControls.ImageButton<BR>img(iCoun ter - 1) = New System.Web.UI.WebControls.ImageButton()<BR>img(iCo unter - 1).ImageUrl = "[my image url, which works fine]"<BR>img(iCounter - 1).AlternateText = "[my image alternate text, which works fine]"<BR>AddHandler img(iCounter - 1).Click, AddressOf Me.img_Click &#039;.NET doesn&#039;t like me :(<BR><BR> Public Sub img_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles img.Click<BR>&#039;never gets here<BR> Response.Redirect(sender.alternatetext)<BR> End Sub<BR><BR>At the top I have:<BR>Protected WithEvents img As System.Web.UI.WebControls.ImageButton<BR><BR>and img is not included in the .aspx page.<BR><BR>Any ideas why that event won&#039;t fire when I click it? I should also mention that the image is added to a table cell which is added to a table row which is added to a table.<BR><BR>Please advise.<BR><BR>Thanks,<BR>Jason

  2. #2
    Join Date
    Dec 1969

    Default how about instead

    adding Hyperlinks that just happen to have an &#060;img&#062; tag as its text?<BR><BR>what you are doing seems like an awful lot of work and overhead just to send the user to a different page

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts