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

Hi 

I am getting this error on my attempt at a repeater control. Any help would be appreciated.
This is the code for the HTML
<asp:Repeater id="rptTests" runat="server"></asp:Repeater>
<ITEMTEMPLATE>
<tr style="BACKGROUND-COLOR: #ffecd8">
<td>
<%# DataBinder.Eval(Container.DataItem, "test") %>
</td>
</tr>
</ITEMTEMPLATE>
This is the code behind page
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("data source = sqlWEB01; initial catalog = testdata;user id = User; password = User")
MyCommand = New SqlDataAdapter("select test from main_entry_table where left(test,1) = '" & ddtestb.selecteditem.text & "'" , MyConnection)
DS = New DataSet()
MyCommand.Fill(DS, "main_entry_table")
rpttests.DataSource = DS.Tables("main_entry_table").DefaultView
rpttests.DataBind()
0
denneboom17
1/8/2004 11:06:38 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
786 Views

Similar Articles

[PageSpeed] 6

I think the syntax is wrong


<asp:Repeater id="rptTests" runat="server"></asp:Repeater> -------> This is wrong try putting it after the </ITEMTEMPLATE>
Try this
<asp:Repeater id="rptTests" runat="server">
<ITEMTEMPLATE>
<tr style="BACKGROUND-COLOR: #ffecd8">
<td>
<%# DataBinder.Eval(Container.DataItem, "test") %>
</td>
</tr>
</ITEMTEMPLATE>
</asp:Repeater>
Raghu Vangala

http://www.code101.com
0
raghucode101
1/8/2004 11:37:42 PM
Reply:

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

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

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

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

ASPNET2 HELP! CS0266: Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.FileUpload'.
Server Error in '/start-movieposters' 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: CS0266: Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.FileUpload'. An explicit conversion exists (are you missing a cast?) Source Error: ...

cannot convert from 'archive_class' to 'System.Web.UI.Control' ??
 i created this class and it takes 2 parameters and then i call that class and pass the parameters and add it to a palceholder control it should create a div tag and add an id and text in it .public archive_class(string DivID,string sText) {HtmlGenericControl div1 = new HtmlGenericControl("div"); div1.InnerText = sText; div1.ID = DivID;return; }   and i call the object here  protected void Page_Load(object sender, EventArgs e) {archive_class arch = new archive_class("someID","someText"); PlaceHolder1.Controls.Add(arch); }   ...

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

'System.Web.UI.Control' cannot be converted to 'String'.
I am trying to run a simple Edit, Update, Delete. I found a simple example in a book I've got. My only concern is withing the string it's first Declaration is Read only, so it won't be edited. and for some reason I am getting this error: The update function that is right after the page_load is giving me the problems. 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: BC30311: Value of type 'Sy...

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

Resources last updated: 2/12/2016 8:21:57 PM