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 on a repeater

how to display image on a repeater

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

    hi. i used repeater to display my records. i want to add an image next to it. if there are 30 records, i want 30 similar images beside that. how to do it in asp/vb.net? any ideas? thanks.. :D:confused:

    M 1 Reply Last reply
    0
    • M MagicGirL83

      hi. i used repeater to display my records. i want to add an image next to it. if there are 30 records, i want 30 similar images beside that. how to do it in asp/vb.net? any ideas? thanks.. :D:confused:

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      If you want the same image in each one, then just put the <img src="..."/> tag inside the repeater's ItemTemplate, wherever you want it positioned in relation to the other ItemTemplate content. If you want the source of the image to be data-driven, you can still put the <img> tag in your ItemTemplate, then use databinding syntax <%# ... %> for the src attribute. Something like this:

      <img src='<%# DataBinder.Eval(Container.DataItem, "MyImageField") %>' />

      In this context, MyImageField would be the name of a field (if your source were say a DataTable) or a property (if your source were an object).

      M 1 Reply Last reply
      0
      • M Mike Ellison

        If you want the same image in each one, then just put the <img src="..."/> tag inside the repeater's ItemTemplate, wherever you want it positioned in relation to the other ItemTemplate content. If you want the source of the image to be data-driven, you can still put the <img> tag in your ItemTemplate, then use databinding syntax <%# ... %> for the src attribute. Something like this:

        <img src='<%# DataBinder.Eval(Container.DataItem, "MyImageField") %>' />

        In this context, MyImageField would be the name of a field (if your source were say a DataTable) or a property (if your source were an object).

        M Offline
        M Offline
        MagicGirL83
        wrote on last edited by
        #3

        thank you so much.. can i just use the picture from my folder?

        B 1 Reply Last reply
        0
        • M MagicGirL83

          thank you so much.. can i just use the picture from my folder?

          B Offline
          B Offline
          bhrugu ranjan das
          wrote on last edited by
          #4

          how to display image on a repeater

          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