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. Using DataList

Using DataList

Scheduled Pinned Locked Moved ASP.NET
questionsysadmin
4 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
    miss nadia
    wrote on last edited by
    #1

    How can i develop a product catalog that diplay a large picture of product and put the description with price under the picture? I use DataList, but the pictures don't appear. Is it true, if i use image handler, my data type for image must be in binary? My current data type for image now is varchar. <asp:DataList id="dlstImages" RepeatColumns="3" runat="server"> <ItemTemplate> <asp:Image ID="Image1" ImageUrl='<%# Eval("Name", "~/UploadImages/{0}") %>' style="width:200px" Runat="server" /> <br /> <%# Eval("Name") %> </ItemTemplate> </asp:DataList>

    S 1 Reply Last reply
    0
    • M miss nadia

      How can i develop a product catalog that diplay a large picture of product and put the description with price under the picture? I use DataList, but the pictures don't appear. Is it true, if i use image handler, my data type for image must be in binary? My current data type for image now is varchar. <asp:DataList id="dlstImages" RepeatColumns="3" runat="server"> <ItemTemplate> <asp:Image ID="Image1" ImageUrl='<%# Eval("Name", "~/UploadImages/{0}") %>' style="width:200px" Runat="server" /> <br /> <%# Eval("Name") %> </ItemTemplate> </asp:DataList>

      S Offline
      S Offline
      Steve Westbrook
      wrote on last edited by
      #2

      Varchar will screw up the data, I would guess. You should definitely use binary fields. However, what you are doing here appears to be linking to an image on the server, not the image in the database; this means that the image name would be in varchar. Is your intention to refer to a folder, or to display the image data directly? Also, you might want to use tags instead of controls; most people would consider it better practice to use the simplest control possible unless there's a good reason not to.

      M 1 Reply Last reply
      0
      • S Steve Westbrook

        Varchar will screw up the data, I would guess. You should definitely use binary fields. However, what you are doing here appears to be linking to an image on the server, not the image in the database; this means that the image name would be in varchar. Is your intention to refer to a folder, or to display the image data directly? Also, you might want to use tags instead of controls; most people would consider it better practice to use the simplest control possible unless there's a good reason not to.

        M Offline
        M Offline
        miss nadia
        wrote on last edited by
        #3

        I use datatype varchar for image (put image path) and display in gridview, this is fine. But when i use the same datatype and display in datalist, the image didn't appear, but the description and price for the product appear. If i use binary for image, then i need to upload the picture to DB, rite? and also use generic handler. what is the easier way to display image for product and the details from different product categories (it's like e-commerce application)?

        S 1 Reply Last reply
        0
        • M miss nadia

          I use datatype varchar for image (put image path) and display in gridview, this is fine. But when i use the same datatype and display in datalist, the image didn't appear, but the description and price for the product appear. If i use binary for image, then i need to upload the picture to DB, rite? and also use generic handler. what is the easier way to display image for product and the details from different product categories (it's like e-commerce application)?

          S Offline
          S Offline
          Steve Westbrook
          wrote on last edited by
          #4

          Displaying binary data directly in ASP is a bit hairy. I'd stick with an <img tag; View Source in IE to see what the path is, and check the data list to see if it's formatting your HTML as text - there should be a property in there somewhere. Again, View Source will help you out. My instinct is that it's some kind of HTML formatting issue.

          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