By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,099 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,099 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.DataIte m, "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

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

<we***********@ebtech.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.DataIte m, "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

Nov 19 '05 #2

P: n/a
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

<we***********@ebtech.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.DataIte m, "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


Nov 19 '05 #3

P: n/a
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

<we***********@ebtech.net> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
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

<we***********@ebtech.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.DataIte m, "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

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.