473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
3 2728
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: blugrasmaniac | last post by:
I have discovered that within a <ASP:REPEATER> control, I can specify multiple tags, such as <ItemTemplate> and <AlternatingItemTemplate>. So that I could write code like following: ...
3
by: Matt Mercer | last post by:
Hi, I have an ASP .NET /VB application over a SQL database. I am designing a print friendly page. The database holds security incidents with the possibility of multiple (or none) people, and...
5
by: Ryan Moore | last post by:
I am trying to modify the onMouseOver attribute of a <td> cell created by a DataList... according to ...
0
by: info | last post by:
I have a datalist with ItemTemplate as a part of my control, however every time the ItemTemplate repeats, it inserts a <br>. How do I get it to not insert a <br>? I need it to be a DataList as...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
2
by: deathtospam | last post by:
Is it possible to Databind to a strongly-typed list of integers (List<int>) ? I want to use <%# Databinder.Eval(Container.DataItem, "XXX") %inside a Repeater control in my ASPX page, but I don't...
0
by: joelgarcia007 | last post by:
I really hope someone can help me with this because it's really driving me crazy. I need to dynamically display multiple data tables on a page so I am using a Repeater to do so and in the...
4
by: Michael | last post by:
I have a repeater web control. Currently I want to change some row's color based on defined condition. Is there any code sample demonstrating how to accomplish it? Thanks.
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.