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. Repeater Control Problem

Repeater Control Problem

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedocker
5 Posts 3 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.
  • T Offline
    T Offline
    tjmule22
    wrote on last edited by
    #1

    Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as.... But if I move the JPG Image1 into the same directory with my code, then this works. Any help would be appreciated.

    M D 2 Replies Last reply
    0
    • T tjmule22

      Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as.... But if I move the JPG Image1 into the same directory with my code, then this works. Any help would be appreciated.

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      tjmule22 wrote: DataBinder.Eval(Container.DataItem, "Image1", "/images/") You should show it with one or two dots: ./images/imagename.jpg ../images/imagesname.jpg Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope

      T 1 Reply Last reply
      0
      • M Mazdak

        tjmule22 wrote: DataBinder.Eval(Container.DataItem, "Image1", "/images/") You should show it with one or two dots: ./images/imagename.jpg ../images/imagesname.jpg Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope

        T Offline
        T Offline
        tjmule22
        wrote on last edited by
        #3

        Thanks....that seemed to solve part of my problem. ../images/imagesname.jpg ...this works as long as I type in the name of the file, however the name of the file is actually stored in a database field. That's why my code looks like this, but for some reason I'm not getting the correct name... This works...with the image name being MYImage ![](<%# DataBinder.Eval(Container.DataItem, _
        "MainPic","../davis/photos/MYImage.gif") %>) but this does not...with MYImage stored in a field name MainPic. ![](<%# DataBinder.Eval(Container.DataItem, _
        "MainPic","../davis/photos/MainPic-{0}") %>)

        1 Reply Last reply
        0
        • T tjmule22

          Using the Repeater control to load text and images. The filenames for the images are stored as text in the database. I would like to have the JPG files located in another folder....but can't seem to get the syntax correct. ...DataBinder.Eval(Container.DataItem, "name", "location of folder" .... no matter what I put in the location of folder area it doesn't work. such as.... But if I move the JPG Image1 into the same directory with my code, then this works. Any help would be appreciated.

          D Offline
          D Offline
          DFU23
          wrote on last edited by
          #4

          This assumes that your images are in a folder named "images" which is in the root of the web site and that the field "Image1" in the database contains only the image file name. If this is the case you just need to concatonate the path to the images to the filename, as is done above. The third parameter of the DataBinder.Eval function is for formatting the data (i.e. "{0:c}" is used to format a number to currency). There might be a way to do what you want through this parameter but contatonating the path will get the job done.

          Wally Atkins
          Newport News, VA, USA
          http://wallyatkins.com

          T 1 Reply Last reply
          0
          • D DFU23

            This assumes that your images are in a folder named "images" which is in the root of the web site and that the field "Image1" in the database contains only the image file name. If this is the case you just need to concatonate the path to the images to the filename, as is done above. The third parameter of the DataBinder.Eval function is for formatting the data (i.e. "{0:c}" is used to format a number to currency). There might be a way to do what you want through this parameter but contatonating the path will get the job done.

            Wally Atkins
            Newport News, VA, USA
            http://wallyatkins.com

            T Offline
            T Offline
            tjmule22
            wrote on last edited by
            #5

            Thank you ....that worked.

            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