repeater problems

J

Jeff

Hey

asp.net 2.0

Below are some code I have 2 problems with.

problem 1:
The items get listed on the same line. I thought each item returned from the
datasource was added to a seperate line in the repeater... (like this: "item
1 item 2") Something must be wrong with how I set this up

problem 2:
The background of the cell is white despite <td bgcolor=blue>

<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DataSourceMode="DataReader"
SelectCommand = "SELECT UserName from aspnet_Users">
</asp:SqlDataSource>
<asp:Repeater ID="rptInbox" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<tr>
<td bgcolor=blue> <%# Eval("UserName") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>

Any ideas what I should do to fix this?

Jeff
 
C

chris

Jeff,

Unless I am missing something you are not creating valid HTML. A
repeater does just what the name implies, it repeats. It does nothing
else automatically. See if this helps:

<asp:Repeater ID="rpt1" runat="server"
DataSourceID="SqlDataSource1">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td bgcolor="blue">
<%# Eval("UserName") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table></FooterTemplate>
</asp:Repeater>

HTH,
Chris
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top