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. image onclick event is not working

image onclick event is not working

Scheduled Pinned Locked Moved ASP.NET
designhelplearning
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.
  • S Offline
    S Offline
    Shoaib Hussain
    wrote on last edited by
    #1

    using System.Web.UI.WebControls; Image thumbImage = new Image(); thumbImage.Attributes.Add("onclick", "window.location.href='" + @"\images\" + filePath + "';"); but the resulting page is giving following error: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /thumbdb/imagesWaterlilies.jpg

    -<>-shoaib-<>-

    A 1 Reply Last reply
    0
    • S Shoaib Hussain

      using System.Web.UI.WebControls; Image thumbImage = new Image(); thumbImage.Attributes.Add("onclick", "window.location.href='" + @"\images\" + filePath + "';"); but the resulting page is giving following error: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /thumbdb/imagesWaterlilies.jpg

      -<>-shoaib-<>-

      A Offline
      A Offline
      atul_deeg
      wrote on last edited by
      #2

      use this thumbImage.Attributes.Add("onclick", "window.location.href='" + @"..\images\" + filePath + "';");

      Vb.net

      S 1 Reply Last reply
      0
      • A atul_deeg

        use this thumbImage.Attributes.Add("onclick", "window.location.href='" + @"..\images\" + filePath + "';");

        Vb.net

        S Offline
        S Offline
        Shoaib Hussain
        wrote on last edited by
        #3

        the problem is that after "window.location.href", browser discardes all the "\" characters. For example the resulting url after following statement is.. thumbImage.Attributes.Add("onclick", "window.location.href='" + @"..\images\" + filePath + "';"); http://localhost:4258/thumbdb/..imagesWaterlilies.jpg You can view that after images there is no any "\" character.

        -<>-shoaib-<>-

        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