Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to get imageurl of Dynamically created Image Button in click event ?

how to get imageurl of Dynamically created Image Button in click event ?

Scheduled Pinned Locked Moved ASP.NET
designtutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    garga1
    wrote on last edited by
    #1

    Hi sir, I have created dynamic imagebuttons. In that postbackurl was not working. So i wrote addhandler. I want to open selected image in new window. How to call the selected image id or get the imageurl in img_Click event..? Dim tRow5 As New HtmlTableRow() tblParticulars.Rows.Add(tRow5) tCell = New HtmlTableCell() tCell.Align = "Left" tCell.Width = 300 Dim Img As New ImageButton Img.ID = "AdvImg" & cnt Txt1 = Ds1.Tables(0).Rows(i).Item("AdvImg") Img.ImageUrl = "~/Photos/" & Txt1 Img.Height = "70" Img.Width = "60" AddHandler Img.Click, AddressOf Me.Img_Click tCell.Controls.Add(Img) tRow5.Cells.Add(tCell) Private Sub img_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) End Sub

    P 1 Reply Last reply
    0
    • G garga1

      Hi sir, I have created dynamic imagebuttons. In that postbackurl was not working. So i wrote addhandler. I want to open selected image in new window. How to call the selected image id or get the imageurl in img_Click event..? Dim tRow5 As New HtmlTableRow() tblParticulars.Rows.Add(tRow5) tCell = New HtmlTableCell() tCell.Align = "Left" tCell.Width = 300 Dim Img As New ImageButton Img.ID = "AdvImg" & cnt Txt1 = Ds1.Tables(0).Rows(i).Item("AdvImg") Img.ImageUrl = "~/Photos/" & Txt1 Img.Height = "70" Img.Width = "60" AddHandler Img.Click, AddressOf Me.Img_Click tCell.Controls.Add(Img) tRow5.Cells.Add(tCell) Private Sub img_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) End Sub

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      you have to give events like :(in C#) Img.Click += new EventHandler(Imgbtn_Click); This will fire the event: protected void Imgbtn_Click(object sender, EventArgs e) { //your code here }

      Padmanabhan

      G 1 Reply Last reply
      0
      • P padmanabhan N

        you have to give events like :(in C#) Img.Click += new EventHandler(Imgbtn_Click); This will fire the event: protected void Imgbtn_Click(object sender, EventArgs e) { //your code here }

        Padmanabhan

        G Offline
        G Offline
        garga1
        wrote on last edited by
        #3

        Sir, i also did the same thing using foll vb code AddHandler Img.Click, AddressOf Me.Img_Click i want to know how to get imageurl or the path of the image so that i can open it in new window when i click the image button in foll function. protected void Imgbtn_Click(object sender, EventArgs e) { //code }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups