Quotes/Double Quotes in Image Control

Discussion in 'ASP .Net' started by Chris White, Sep 22, 2004.

  1. Chris White

    Chris White Guest

    I'm trying to put a dynamic image inside a Data Repeater.

    <asp:Repeater id="repModels" runat="server">
    <ItemTemplate>
    <asp:Image id="Image1" runat="server" ImageUrl="images/cars/small/<%#
    Databinder.Eval(Container.DataItem, "Picture") %>">
    </asp:Image>
    </ItemTemplate>
    </asp:Repeater>

    This was giving me Parser Error Message: The server tag is not well formed
    After doing some searching, I replaced the outer double quotes with single
    quotes

    <asp:Repeater id="repModels" runat="server">
    <ItemTemplate>
    <asp:Image id="Image1" runat="server" ImageUrl='images/cars/small/<%#
    Databinder.Eval(Container.DataItem, "Picture") %>'>
    </asp:Image>
    </ItemTemplate>
    </asp:Repeater>

    This doesn't work, the Databinder.Eval does not even get parsed.
    And why does the above Not work and the code below does?

    <asp:Repeater id="repModels" runat="server">
    <ItemTemplate>
    <asp:HyperLink id="Hyperlink1" NavigateUrl='' Text='<%#
    Databinder.Eval(Container.DataItem, "Picture") %>' Runat="server">
    </asp:HyperLink>
    </ItemTemplate>
    </asp:Repeater>

    And finally, is there any real benefit using an asp:Image tag instead of an
    img tag?
     
    Chris White, Sep 22, 2004
    #1
    1. Advertising

  2. Chris White

    Hermit Dave Guest

    try this
    <asp:Repeater id="repModels" runat="server">
    <ItemTemplate>
    <asp:Image id="Image1" runat="server" ImageUrl='<%#
    "images/cars/small/ " +
    Databinder.Eval(Container.DataItem, "Picture") %>'>
    </asp:Image>
    </ItemTemplate>
    </asp:Repeater>

    --

    Regards,

    Hermit Dave
    (http://hdave.blogspot.com)
    "Chris White" <chrisjwhite@@@mindspring...com> wrote in message
    news:#...
    > I'm trying to put a dynamic image inside a Data Repeater.
    >
    > <asp:Repeater id="repModels" runat="server">
    > <ItemTemplate>
    > <asp:Image id="Image1" runat="server" ImageUrl="images/cars/small/<%#
    > Databinder.Eval(Container.DataItem, "Picture") %>">
    > </asp:Image>
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > This was giving me Parser Error Message: The server tag is not well formed
    > After doing some searching, I replaced the outer double quotes with

    single
    > quotes
    >
    > <asp:Repeater id="repModels" runat="server">
    > <ItemTemplate>
    > <asp:Image id="Image1" runat="server" ImageUrl='images/cars/small/<%#
    > Databinder.Eval(Container.DataItem, "Picture") %>'>
    > </asp:Image>
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > This doesn't work, the Databinder.Eval does not even get parsed.
    > And why does the above Not work and the code below does?
    >
    > <asp:Repeater id="repModels" runat="server">
    > <ItemTemplate>
    > <asp:HyperLink id="Hyperlink1" NavigateUrl='' Text='<%#
    > Databinder.Eval(Container.DataItem, "Picture") %>' Runat="server">
    > </asp:HyperLink>
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > And finally, is there any real benefit using an asp:Image tag instead of

    an
    > img tag?
    >
    >
     
    Hermit Dave, Sep 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    1
    Views:
    13,762
    Oisin
    Mar 24, 2006
  2. Lawrence Tierney

    Multiline quotes - escaping quotes - et al

    Lawrence Tierney, Dec 24, 2003, in forum: Java
    Replies:
    3
    Views:
    4,550
    Andrew Thompson
    Dec 24, 2003
  3. Sydex
    Replies:
    12
    Views:
    6,653
    Victor Bazarov
    Feb 17, 2005
  4. jOhn
    Replies:
    1
    Views:
    274
    Phlip
    Jan 29, 2008
  5. Richard Sandoval
    Replies:
    5
    Views:
    233
    7stud --
    Apr 26, 2011
Loading...

Share This Page