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. handle imagebutton click in gridview

handle imagebutton click in gridview

Scheduled Pinned Locked Moved ASP.NET
comhelp
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.
  • C Offline
    C Offline
    ChrisFarrugia
    wrote on last edited by
    #1

    Dear All, I am placing an image button inside a gridview: | | | protected void equipmentGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandSource=="image") { Response.Redirect("http://www.google.com"); } } I want to be able to handle the click of the imagebutton. I tried using onrowcommand but the application is not even accessign the method it just returns an in valid postback error. I tried modifying the event validation to true but no success. the error does not pop up but the method is still not invoked. Thanks a lot Chris

    N 1 Reply Last reply
    0
    • C ChrisFarrugia

      Dear All, I am placing an image button inside a gridview: | | | protected void equipmentGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandSource=="image") { Response.Redirect("http://www.google.com"); } } I want to be able to handle the click of the imagebutton. I tried using onrowcommand but the application is not even accessign the method it just returns an in valid postback error. I tried modifying the event validation to true but no success. the error does not pop up but the method is still not invoked. Thanks a lot Chris

      N Offline
      N Offline
      nateraaaa
      wrote on last edited by
      #2

      Change your if statement to check the e.CommandName instead of e.CommandSource. if(e.CommandName == "imageClick") { Response.Redirect("http://www.google.com"); } I also noticed that your ImageButton id said i="image" instead of id="image" but that could just be a typo. Nathan

      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