multiple <td> in a repeater control <ItemTemplate> (asp.net 2)

Discussion in 'ASP .Net' started by webserverpete@ebtech.net, Aug 16, 2005.

  1. Guest

    I would like to have multiple <td> in a repeater control. The below
    code does not work:
    <asp:Repeater ID="Repeater1" runat="server"
    DataSourceID="SqlDataSource1" DataMember="DefaultView">
    <HeaderTemplate>
    <table>
    </HeaderTemplate>
    <tr>
    <ItemTemplate>
    <td>
    <%#DataBinder.Eval(Container.DataItem, "itemname")%>
    $<%#FormatNumber(DataBinder.Eval(Container.DataItem, "itemprice"), 2)%>

    <img src="images/<%#DataBinder.Eval(Container.DataItem,
    "picfilename")%>">
    <%#DataBinder.Eval(Container.DataItem, "itemdescription")%>
    <%#DataBinder.Eval(Container.DataItem, "itemaddtime")%>
    </td>
    </ItemTemplate>
    </tr>
    <FooterTemplate>
    </table>
    </FooterTemplate>
    </asp:Repeater>

    The problem with the above is the <tr>, if I take that out then that
    page works. However this does not produce the disired results. I would
    like to have more than five <td> in a <tr>, essentially wrapping the
    <ItemTemplate> tag with <tr> tags and only repeating the <ItemTemplate>
    five times.

    Any help would be greatly appreciated,
    Pete
     
    , Aug 16, 2005
    #1
    1. Advertising

  2. Pete,

    If I understand you correctly, you want to have just one row and the
    repeater items as cells? In this case you should use

    <HeaderTemplate>
    <table><tr>
    </HeaderTemplate>

    and

    <FooterTemplate>
    </tr></table>
    </FooterTemplate>

    Eliyahu

    <> wrote in message
    news:...
    > I would like to have multiple <td> in a repeater control. The below
    > code does not work:
    > <asp:Repeater ID="Repeater1" runat="server"
    > DataSourceID="SqlDataSource1" DataMember="DefaultView">
    > <HeaderTemplate>
    > <table>
    > </HeaderTemplate>
    > <tr>
    > <ItemTemplate>
    > <td>
    > <%#DataBinder.Eval(Container.DataItem, "itemname")%>
    > $<%#FormatNumber(DataBinder.Eval(Container.DataItem, "itemprice"), 2)%>
    >
    > <img src="images/<%#DataBinder.Eval(Container.DataItem,
    > "picfilename")%>">
    > <%#DataBinder.Eval(Container.DataItem, "itemdescription")%>
    > <%#DataBinder.Eval(Container.DataItem, "itemaddtime")%>
    > </td>
    > </ItemTemplate>
    > </tr>
    > <FooterTemplate>
    > </table>
    > </FooterTemplate>
    > </asp:Repeater>
    >
    > The problem with the above is the <tr>, if I take that out then that
    > page works. However this does not produce the disired results. I would
    > like to have more than five <td> in a <tr>, essentially wrapping the
    > <ItemTemplate> tag with <tr> tags and only repeating the <ItemTemplate>
    > five times.
    >
    > Any help would be greatly appreciated,
    > Pete
    >
     
    Eliyahu Goldin, Aug 16, 2005
    #2
    1. Advertising

  3. Guest

    That is almost what I was looking for. I would like to have every five
    records returned to be in their own set of <tr> tags so there would be
    more than one set of <tr> tags.

    Thanks again for your help,
    Pete

    Eliyahu Goldin wrote:
    > Pete,
    >
    > If I understand you correctly, you want to have just one row and the
    > repeater items as cells? In this case you should use
    >
    > <HeaderTemplate>
    > <table><tr>
    > </HeaderTemplate>
    >
    > and
    >
    > <FooterTemplate>
    > </tr></table>
    > </FooterTemplate>
    >
    > Eliyahu
    >
    > <> wrote in message
    > news:...
    > > I would like to have multiple <td> in a repeater control. The below
    > > code does not work:
    > > <asp:Repeater ID="Repeater1" runat="server"
    > > DataSourceID="SqlDataSource1" DataMember="DefaultView">
    > > <HeaderTemplate>
    > > <table>
    > > </HeaderTemplate>
    > > <tr>
    > > <ItemTemplate>
    > > <td>
    > > <%#DataBinder.Eval(Container.DataItem, "itemname")%>
    > > $<%#FormatNumber(DataBinder.Eval(Container.DataItem, "itemprice"), 2)%>
    > >
    > > <img src="images/<%#DataBinder.Eval(Container.DataItem,
    > > "picfilename")%>">
    > > <%#DataBinder.Eval(Container.DataItem, "itemdescription")%>
    > > <%#DataBinder.Eval(Container.DataItem, "itemaddtime")%>
    > > </td>
    > > </ItemTemplate>
    > > </tr>
    > > <FooterTemplate>
    > > </table>
    > > </FooterTemplate>
    > > </asp:Repeater>
    > >
    > > The problem with the above is the <tr>, if I take that out then that
    > > page works. However this does not produce the disired results. I would
    > > like to have more than five <td> in a <tr>, essentially wrapping the
    > > <ItemTemplate> tag with <tr> tags and only repeating the <ItemTemplate>
    > > five times.
    > >
    > > Any help would be greatly appreciated,
    > > Pete
    > >
     
    , Aug 16, 2005
    #3
  4. Then you need a datalist rather than a repeater. You can set it up to show 5
    items in a row. And you don't need to care about table tags yourself, it
    will do it for you.

    Eliyahu

    <> wrote in message
    news:...
    > That is almost what I was looking for. I would like to have every five
    > records returned to be in their own set of <tr> tags so there would be
    > more than one set of <tr> tags.
    >
    > Thanks again for your help,
    > Pete
    >
    > Eliyahu Goldin wrote:
    > > Pete,
    > >
    > > If I understand you correctly, you want to have just one row and the
    > > repeater items as cells? In this case you should use
    > >
    > > <HeaderTemplate>
    > > <table><tr>
    > > </HeaderTemplate>
    > >
    > > and
    > >
    > > <FooterTemplate>
    > > </tr></table>
    > > </FooterTemplate>
    > >
    > > Eliyahu
    > >
    > > <> wrote in message
    > > news:...
    > > > I would like to have multiple <td> in a repeater control. The below
    > > > code does not work:
    > > > <asp:Repeater ID="Repeater1" runat="server"
    > > > DataSourceID="SqlDataSource1" DataMember="DefaultView">
    > > > <HeaderTemplate>
    > > > <table>
    > > > </HeaderTemplate>
    > > > <tr>
    > > > <ItemTemplate>
    > > > <td>
    > > > <%#DataBinder.Eval(Container.DataItem, "itemname")%>
    > > > $<%#FormatNumber(DataBinder.Eval(Container.DataItem, "itemprice"),

    2)%>
    > > >
    > > > <img src="images/<%#DataBinder.Eval(Container.DataItem,
    > > > "picfilename")%>">
    > > > <%#DataBinder.Eval(Container.DataItem, "itemdescription")%>
    > > > <%#DataBinder.Eval(Container.DataItem, "itemaddtime")%>
    > > > </td>
    > > > </ItemTemplate>
    > > > </tr>
    > > > <FooterTemplate>
    > > > </table>
    > > > </FooterTemplate>
    > > > </asp:Repeater>
    > > >
    > > > The problem with the above is the <tr>, if I take that out then that
    > > > page works. However this does not produce the disired results. I would
    > > > like to have more than five <td> in a <tr>, essentially wrapping the
    > > > <ItemTemplate> tag with <tr> tags and only repeating the

    <ItemTemplate>
    > > > five times.
    > > >
    > > > Any help would be greatly appreciated,
    > > > Pete
    > > >

    >
     
    Eliyahu Goldin, Aug 16, 2005
    #4
    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. Bennett Haselton
    Replies:
    1
    Views:
    5,412
    Joe Fallon
    Sep 24, 2004
  2. Shimon Sim

    Repeater.ItemTemplate =?

    Shimon Sim, Jan 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    980
    Karl Seguin
    Jan 27, 2005
  3. Sachin
    Replies:
    1
    Views:
    1,226
    sloan
    Feb 21, 2006
  4. Replies:
    1
    Views:
    197
  5. Stan
    Replies:
    2
    Views:
    207
Loading...

Share This Page