BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'

D

djc

I don't know why I'm getting this error? This is my first time using a
repeater and the Container.DataItem code. It looks to me like I'm doing
exactly what the examples I've looked at are doing.

<snippet>
Dim da As SqlDataAdapter = New SqlDataAdapter(cmdDetail)
Dim dt As DataTable = New DataTable()
da.Fill(dt)
rptrDetails.DataSource = dt
rptrDetails.DataBind()
</snippet>

<snippet>
<asp:Repeater id="rptrDetails" runat="server"/>
<ItemTemplate>
<div class="DetailDiv">
<div class="TitleBarDiv"><%#
Container.DataItem("EnteredBy") %> &nbsp on: &nbsp <%#
Container.DataItem("DateCreated") %></div>
<div class="DetailDivContentDiv">
<%# Container.DataItem("DetailEntry") %>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</snippet>

The page has include directives for System.Data and System.Data.SqlClient.

1) what could cause this problem?
2) would this error occur if the data table was empty? no records returned?

any info is appreciated. Thanks.
 
D

djc

I found the issue. If you look at the line starting the repeater control
creation you will see that I accidentally used the '/>' to end the tag. So
that repeater control declaration ended right there instead of with the
</asp:Repeater> further down the page. whoops. : (
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,133
Latest member
MDACVReview
Top