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

  • Thread starter Thread starter djc
  • Start date Start date
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.
 
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. : (
 
Back
Top