Data not displayed in Repeater

G

Guest

I created a Repeater (rp1) that is bound to a Datatable, t1. The DataSource
and Datamember properties of rp1 was specified in the properties window as
"ds" and "t1" respectively.

The following code was also included in the HTML view of the form. However,
only the HeaderTemplate rendered in the browser.

<asp:Repeater id="rp1" runat="server">
<HeaderTemplate>
<Table><tr>
<td>Song Name</td>
<td>Artist</td>
<td>Genre</td>
</tr></Table>
</HeaderTemplate>
<ItemTemplate>
<Table><tr>
<td><%# DataBinder.Eval(Container, "DataItem.Song Name") %>
<%# DataBinder.Eval(Container, "DataItem.Artist") %>
<%# DataBinder.Eval(Container, "DataItem.Genre")>
</td>
</tr></Table>
</ItemTemplate>
</asp>
 
G

Guest

2 observations:
1) The markup below is not well-formed. You have there an ending </asp>
instead of </asp:Repeater>,
2) The repeater will render the HeaderTemplate if the datatable is empty
(i.e. no records were retrieved by the query). Use the debugger to step
through the code and verify that you data query retrieved records.
 
G

Guest

There are data within the DataTable and I placed the breakpoint on the 1st
statement at <%# DataBind.Eval(Container, "DatatItem.SongName") %>.

The JScript code was stepped through and the data are still not displayed.
Don't know what's wrong.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top