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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. image button click event [modified]

image button click event [modified]

Scheduled Pinned Locked Moved ASP.NET
help
2 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.
  • H Offline
    H Offline
    harithadotnet
    wrote on last edited by
    #1

    Hi I created image buttons dynamicaly an i wrote click event for image controls. but click event is not working code is as follows for (int i = 1; i < 11; i++) { img = new ImageButton(); img.ID = "img" +i.ToString(); img.ImageUrl="pg/1212/"+ i +".jpg"; img.Click += new ImageClickEventHandler( img_Click ); pl.Controls.Add(img); (pl is place holder control id) } protected void img_Click ( object sender, ImageClickEventArgs e ) { ImageButton img = ( ImageButton )sender; Response.Write(img.ID + ""); } after page load when i click image button, click event is not working... control is not going to click event plz help me Thanks in advance. Haritha -- modified at 5:00 Monday 28th May, 2007

    Haritha

    N 1 Reply Last reply
    0
    • H harithadotnet

      Hi I created image buttons dynamicaly an i wrote click event for image controls. but click event is not working code is as follows for (int i = 1; i < 11; i++) { img = new ImageButton(); img.ID = "img" +i.ToString(); img.ImageUrl="pg/1212/"+ i +".jpg"; img.Click += new ImageClickEventHandler( img_Click ); pl.Controls.Add(img); (pl is place holder control id) } protected void img_Click ( object sender, ImageClickEventArgs e ) { ImageButton img = ( ImageButton )sender; Response.Write(img.ID + ""); } after page load when i click image button, click event is not working... control is not going to click event plz help me Thanks in advance. Haritha -- modified at 5:00 Monday 28th May, 2007

      Haritha

      N Offline
      N Offline
      Nouman Bhatti
      wrote on last edited by
      #2

      The only problem that i think will causing u this problem is that u write the code for creating images in the Page_Load event, u must write it in Page_init event

      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