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. displaying image in datalist.?

displaying image in datalist.?

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
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
    Mir_As
    wrote on last edited by
    #1

    i want to display my images in datalist. i save my images path in access database(like this Product\hotel\product1.gif) my images are in a speial folder which under the App_Data. how can i connect datalist-images directory-image? i connected to database with accessdatasource1.

    N 1 Reply Last reply
    0
    • M Mir_As

      i want to display my images in datalist. i save my images path in access database(like this Product\hotel\product1.gif) my images are in a speial folder which under the App_Data. how can i connect datalist-images directory-image? i connected to database with accessdatasource1.

      N Offline
      N Offline
      Nishant Singh
      wrote on last edited by
      #2

      U need to use an Image Control in DataList(Edit Template) and set the Image Control URL in ItemDataBound event of DataList

      protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
      {
      Image I1 = (Image)(e.Item.FindControl("Imagex"));
      I1.ImageUrl = dth.Rows[e.Item.ItemIndex]["ImageURL"].ToString();
      }

      "dth" is the DataTable which I am using as DataSource for DataList The URL should be "App_Data/product1.gif",to retrieve the image . As in ur case if URL is stored as eg:Product\hotel\product1.gif Then you need to convert it to "App_Data/product1.gif", using string manipulation .

      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