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 display Image Description?

How to display Image Description?

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

    :(I have a repeater control to display thumbnail pictures. The itemtemplate is made of html image control. When user clicks on the thumbnail picture, I want it to display a larger image and display the image description in a label( the image description is saved in database). The large image is also a html control. My current code is : I have a getPhoto function which will get the thumbnail pictures through IhttpHandler and bound to the repeater control. Then I have a repPhotoG_ItemDataBound function, here I add the javascript to the image html control and call a javascript to pass the thumbnail imagename as parameter and show the large image. All this works fine, but I just don’t know how to get and display the image description. Please help!! private void repPhotoG_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { //finding repeater item Image System.Web.UI.HtmlControls.HtmlImage img=(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("iPhoto"); //create a relative path for image and add onclick function img.Src=img.Src.Replace('\\', '/'); string Description=""; string Image; Image=IMGpath(img.Src); img.Attributes["onclick"]="showImg('"+Image+"')"; } function showImg(imgName,Description) { imgOn = ("" + imgName); document.imgLarge.filters[0].Apply(); document.imgLarge.src = imgOn; hdr.innerHTML=imgName; document.imgLarge.filters[0].Play(); Jin

    R 1 Reply Last reply
    0
    • M mujin03

      :(I have a repeater control to display thumbnail pictures. The itemtemplate is made of html image control. When user clicks on the thumbnail picture, I want it to display a larger image and display the image description in a label( the image description is saved in database). The large image is also a html control. My current code is : I have a getPhoto function which will get the thumbnail pictures through IhttpHandler and bound to the repeater control. Then I have a repPhotoG_ItemDataBound function, here I add the javascript to the image html control and call a javascript to pass the thumbnail imagename as parameter and show the large image. All this works fine, but I just don’t know how to get and display the image description. Please help!! private void repPhotoG_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { //finding repeater item Image System.Web.UI.HtmlControls.HtmlImage img=(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("iPhoto"); //create a relative path for image and add onclick function img.Src=img.Src.Replace('\\', '/'); string Description=""; string Image; Image=IMGpath(img.Src); img.Attributes["onclick"]="showImg('"+Image+"')"; } function showImg(imgName,Description) { imgOn = ("" + imgName); document.imgLarge.filters[0].Apply(); document.imgLarge.src = imgOn; hdr.innerHTML=imgName; document.imgLarge.filters[0].Play(); Jin

      R Offline
      R Offline
      RSindia
      wrote on last edited by
      #2

      1. If you are using ASP.NET 2.0 then you can use client callback functionality to get the description from the database and fill the description label. 2. otherwise like passing image path to the javascript funciton you can also pass the description. rsankarindia

      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