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

I was going through the "WEb Matrix Guided Tour" and ran across the following error when I tried to do the section "ASP.NET Pages with Data (SQL Server/MSDE) DataList and Templates".  I went through it three times and can not get past this point.  Any suggestions would be appreciated.  

PS: Rookie to this, so please be kind!!!

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
Source Error:

Line 48: <p>
Line 49: First Name: <asp:Label id="Label1" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "FirstName") %>'></asp:Label>
Line 50: <br />
Line 51: </p>

8/21/2004 5:55:30 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 49

It seems that the Container in your case is pointing to the wrong control, which possibly has to do with the structure of the markup language. A typical example of a right structure is this one:

<asp:DataList id="dl" runat="server">

<asp:Label id="lbl" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "FirstName") %>' />

Please check whether this matches your general structure.
Bart De Smet [MVP]

Visit www.msdn.be, www.bartdesmet.net
8/21/2004 10:38:04 AM
Right on!   The </aspDataList> command was in the wrong spot.  I will call you Bart De Smart for now on!  Thanks!
8/21/2004 2:26:51 PM

Similar Artilces:

BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
 I am getting compilation error (bold line): BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'. I am using ASP.NET 2.0 - w/AJAX 2.0 Extension. <asp:UpdatePanel UpdateMode="Always" runat="server">             <ContentTemplate>                   <asp:LinkButton ID="rateit" runat="server" CssClass="vote" Height="56px" Width="63px&...

Error: BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
I wanted to create a nested DataList with two dataTables.  I followed the steps.   First, set relation to the two datatables in a dataset ds1.Relations.Add("myRelation", ds1.Tables(0).Columns("intMenuItemID"), ds1.Tables(1).Columns("intParentMenu"))     Second, bind the dataset       DataList1.DataSource = ds1.Tables(0).DefaultView       DataList1.DataBind()   Third, add the following to the DataList datasource property       Container.DataItem.Row.GetChildRows("myRelation") &...

Nested repeater and BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
I've got an application where I can make use a nested repeater... I found this Microsoft How To: http://support.microsoft.com/kb/326338/EN-US and attempted to copy that code, but I'm stuck getting the error in the subject. As far as I can tell, my code is all good but for whatever reason it's just not working the way it should. I've posted the code and code-behind pages below, if you have any thoughts on what I can do to fix this please let me know! The line that brings up the compilation error is: <asp:Repeater ID="childRepeater" Runat="server" DataSource='<...

Getting 'System.Web.UI.Control' does not contain a definition for 'DataItem' error on controls when placed inside an update panel which is in a template.
Using the June CTP, I;ve got an updatepanel inside the itemtemplate of a datalist which is now suppopsed to be supported (it works). I also have some asp controls (imagebutton, label) which get their values dynamically (DataBinder.Eval(Container.DataItem, "fieldname").ToString(). This would work fine before putting the updatepanel in the datalist itemtemplate, I now get the error in the title when building ('System.Web.UI.Control' does not contain a definition for 'DataItem') for each control... How can I dynamically assign the values to the controls in the datalist when also using upd...

'DataItem' is not a member of 'System.Web.UI.Page'
I am getting this error when compiling the following code: <%@ Import Namespace="System.IO"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Data"%><script language="VB" runat="server"> Dim savePath As String = "C:\upload\"Sub Upload_Click(source As Object, e As EventArgs)   If Not (uploadedFile.PostedFile Is Nothing) Then    Try      Dim postedFile = uploadedFile.PostedFile      Dim filename As String = Path.GetFi...

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am getting this error does anyone knows how to solve this :DHighOnCodingWanna get high! Show us the code that produces this error. Other than the exactness of the error, which explains what is exactly happening, we can't see why this is happening without seeing your code.David WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer' when i...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am recieving this error: 'System.Web.UI.Control' does not contain a definition for 'DataItem' What iam trying to do is when a user clicks the hyperlink column in the datagrid then the ID of that user is send to another page and I need to run the Query or something and bind the Label on the page 2 with the name of the Person. So I am using the HTML view and writing something like this : '<%# DataBinder.Eval(Container.DataItem,"Name") %> ' here is my code behind file so how can i bind the Name of the person with the label: private void Page_Lo...

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Error: Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField'
Hello, I am getting the following error during compiliation. Any suggestions to fix it. Thanks. Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField' protected void gvEvents_RowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gvEvents.Rows[index]; string sID; ButtonField btn; if (selectedRow.RowType == DataControlRowType.DataRow) { sID = ((ButtonField)selectedRow.FindControl("ID")).DataTextFi...

'System.Web.UI.IDataItemContainer.DataItem' is a 'property' but is used like a 'method'
On the line "<%# Container.DataItem("BlogID") %>", I get the error listed in the title of this post. I'm not sure why, I use this same for on other pages to get data from a database and I don't get this error.         <asp:GridView ID="GridView1"         runat="server"         AutoGenerateColumns="False"         DataKeyNames="BlogID"        D...

'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected
I get the following error when trying to compile my project. The call to Context lies in a usercontrol. It works fine when called from a page, but how do I call it from a usercontrol? private User _currentUser = new User(Context.User.Identity.Name); 'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected Firefox - The browser you can trust Update: private User _currentUser = new User(Context.User.Identity.Name);Is declared inside the class, not in a function. Like: public class Someclass : System.Web.UI.UserControl { private User _currentUser = new...

Value of type 'System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap'.
 Hello,         I receive this error "System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap" when I try to find the Sitemap control.  ...            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />            <asp:ListView ID="ListView1" runat="server">            <LayoutTemplate>    ...

Web resources about - 'DataItem' is not a member of 'System.Web.UI.Control' - asp.net.getting-started

Resources last updated: 12/20/2015 10:59:01 AM