1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to display image in ListView

Discussion in 'C#' started by gutierrez3711, Jun 8, 2011.

  1. #1
    Hi,
    SEMrush
    Can anyone help me with displaying images in the list view for the records ? My database has an Images table which associates an image with a record based on a ForeignKey and is also containg a column with the url of the image (most images would probably be stored locally in the Images folder of the project therefore the url would probably be something like "~\Images\Img1.gif").

    Thank you!
     
    gutierrez3711, Jun 8, 2011 IP
    SEMrush
  2. yugolancer

    yugolancer Well-Known Member

    Messages:
    321
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #2
    It's pretty str8 forward. Just add an image control inside the ItemTemplate e.g.

    <ItemTemplate>
          <asp:Image ID="MyImage" runat="server" ImageUrl='<%# Eval("ColumnName") %>' />
    </ItemTemplate>
    Code (markup):
     
    yugolancer, Jun 9, 2011 IP
  3. unknownpray

    unknownpray Active Member

    Messages:
    3,832
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    70
    #3
    It is very easy to add image in view list

    just type the code
    as: <ItemTemplate>
    <asp:Image ID="MyImage" runat="server" ImageUrl='<%# Eval("ColumnName") %>' />
    </ItemTemplate>
     
    unknownpray, Jun 25, 2011 IP