Repeater: nested controls cause error: 'object' does not contain a definition for 'DataItem'

I'm trying to use a Repeater control to create a series of other controls. The problem seems to be that when I try to access "Container.DataItem" the Container is now my nested control instead of the Repeater control. How do I get the Container.DataItem to point back to my Repeater instead of the nested control?


Sample code:

<asp:Repeater ID="CardRepeater" runat="server">



<ComponentArt:Snap runat="server"






DockingStyle="TransparentRectangle" DraggingStyle="GhostCopy" MustBeDocked="True">


<div style="CURSOR: move; width: 100%;">

<table cellSpacing="0" cellPadding="0" width="100%" border="0">


<td class="SnapHeader" onmousedown="SnapCard.StartDragging(event)" >

<%# GetHeaderText(Container.DataItem)) %>   <-- this is the problem here! Container is of type "Snap" instead of "RepeaterItem"


<td width="10" style="cursor: hand" align="right">

<img onclick="SnapCard.toggleExpand()" src="images/i_open.gif" width="22" height="19" border="0">







<table class="Snapcontent" cellSpacing="0" cellPadding="0" width="100%" border="0">


<td><%# GetContentText(DataItem)%></td>    <-- this is the problem here!







9/14/2007 1:53:20 AM 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 32

I found the solution - I had to look up the parent and cast the type.

<%# GetHeaderText(((RepeaterItem)Container.Parent).DataItem) %>

9/14/2007 2:36:44 PM

Similar Artilces:

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...

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: Note to readers: Hendrix gives...

'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...

'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/ - 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...

''null' or not an object' error using validation controls in user control
Wonder if anybody has come across this before.I’m using Atlas together with some user controls I’ve created for user input that has validation controls on the forms.  If I remove the validation controls then all works fine… however once they are enabled I get a very annoying javascript error saying “ ‘null’ is null or not an object “ Where do I even start debugging this? If somebody knows what im doing wrong or how I could fix this please let me know.   Thanks ...

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: 'object' does not contain a definition for 'methodName'
I have a class and a page. The class has a method called RetrieveImage(int idx). In the Page_Load event, I called the RetrieveImage(3). example: Page_Load() {   ImagePrint objImage = new ImagePrint();   objImage.RetrieveImage(3);} I get the error CS0117: 'ImagePrint' does not contain a definition for 'RetrieveImage'   what am I missing? any clue would be appreciated. I'm still stuck. Is your ImagePrint class in the same namespace as the Page class that is trying to use it? NC...   No. The ImagePrint is a class inside the App_Code directory under a ...

Error: 'Object' does not contain a definition for 'object__field'
The problem is as follows. I'm trying to reduce the number calls I'm making into the SalesForce API. Currently, I use 3 calls to obtain the fields I need from the Account Object.  Here are the three methods I'm using: private string getContactId(string selfServiceUserName)    {        QueryResult qr = null;         sfdc.QueryOptionsValue = new QueryOptions();        sfdc.QueryOptionsValue.batchSize = 1;        sfdc.Query...

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: 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='<...

error CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'
Hi,I tried samples on preventing javascript injection attacks tutorial( and while executing i am getting this error. d:\DotNet\MVCapplication\MvcApplication1\MvcApplication1\Views\Home\Index.aspx(23): error CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'Pls suggest me.   The problem is this line in the tutorial code: foreach (Feedback feedback in ViewData.Model) You either need to cast ViewData.Model ...

'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'
I have created a custom control which inherits from a compositeControl. Its all works well in the browser but when I show it in the design mode I geta gray box with the following message Error Creating Control - GroupPicker1'true' could not be set on property 'ShowRadioButtons'. The Property is a fairly standard get and set Public Property ShowRadioButtons() As Boolean            Get                Return rowRadioButtons.Visible  &nbs...

'object' does not contain a definition for 'Reaction'
Hi,,the following code shows the error, 'object' does not contain a definition for 'Reaction' if (objError.Reaction==0) { throw; } plz solve this issue Thanks   Post the code of objError. Looks like reaction is not defind there.ASP.NET Hosting (HostingFest)...

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") &...

Error 39 'System.Data.DataRow' does not contain a definition for 'Item'
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { categoryID = ds.Tables[0].Rows[i].Item["categoryID"]; name = ds.Tables[0].Rows[i].Item["name"]; string catID = Convert.ToString(categoryID); ///Change made by me ddlCategory.Items.Add(new ListItem(name, catID)); qry = "Select count(categoryID) from categories where active = 'True' AND parentID=" + categoryID + ""; countCategories = objDB.getScalar(qry);       i get this errorIf the going seems easy, You are going DownHill... I've got the solution what you have to ...

Web resources about - Repeater: nested controls cause error: 'object' does not contain a definition for 'DataItem' -

Resources last updated: 12/28/2015 8:49:19 PM