473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

How do I bind an array, arrayList or even a stack to a repeater
containing hyperlinks.

The data structure (array, arrayList or even a stack) has dates
in ISO format "YYYY-MM-DD". The repeated hyperlinks will be
displayed, for example, in this form:

<a href='default.aspx?arc=2004-06-29'>2004-06-29</a>

or, better:

<a href='default.aspx?arc=2004-06-29'>June 29, 2004</a>

------ ------ ------ ------ ------
I get an error:
------ ------ ------ ------ ------

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

for this line:

Text='<%# Databinder.Eval((Container).DataItem) %>'

This is the Detailed Compiler Output:

target.Text = System.Convert.ToString(Container.DataItem[0])

PS 1: This page is made up of many controls and this is just one
of them. Some of the others already have Page_Load events.

PS 2: I've tried to change the line but each of the following
give the same error on the same line.

Text='<%# Container.DataItem %>'
Text='<%# Container.DataItem[0] %>'
Text='<%# (Container.DataItem)[0] %>'
Text='<%# Container.DataItem("Value") %>'
Text='<%# DataBinder.Eval( Container.DataItem[0] ) %>'
Text='<%# DataBinder.Eval( Container.DataItem("Value") ) %>'
Text='<%# DataBinder.Eval( Container.DataItem, "Value" ) %>'

PS 3: To make it easy for you I expect the ArrayList to look
something like this:

{"2004-05-19", "2004-06-29" }
------ ------ ------ ------ ------
Here is my control containing the code.
------ ------ ------ ------ ------

<%@ Import Namespace="System.IO" %>
<Script Runat="Server">

Const vbARCHIVE_FILENAME =
"2004_99_99_net-example_archive.xml"
Const vbPOST_BACK_FILE = "default.aspx"

Sub Page_Load(vbARCHIVE_FILENAME As String)

Dim aryFileNames As Array
Dim aryDates As ArrayList

Dim lenARCHIVE As Integer
Dim i As Integer
Dim fileName As String
Dim xmlFilePath As String
Dim strISODate As String

lenARCHIVE = Len(vbARCHIVE_FILENAME) - Len("2004-99-99")

xmlFilePath = Server.MapPath( "blogs/blog.xml" )
aryFileNames = Directory.GetFiles( Left(xmlFilePath,
Len(xmlFilePath)-8) )

For Each fileName in aryFileNames
If LCase(Right(fileName, lenARCHIVE)) =
Right(vbARCHIVE_FILENAME, lenARCHIVE) Then
aryDates.Add( Replace (Left(fileName, 10),"_", "-" ) )
End If
Next

rptRHS_Menu.DataSource = aryDates
rptRHS_Menu.DataBind()
End Sub

</Script>

<!-- Sidebar (RHS Menu) -->
<h6 title="older blogs">archives</h6>
<img src="images/pixel_gr.gif" height="2" width="130"><br />

<asp:Repeater
ID="rptRHS_Menu"
Runat="Server" />
<ItemTemplate>
<ASP:HyperLink
ID="lnkItem"
Text='<%# Container.DataItem[0] %>'
NavigateUrl='<%# string.Concat(vbPOST_BACK_FILE,
"?arc=", Container.DataItem[0] %>'
Runat="Server" />
</ItemTemplate>
</asp:Repeater>
<!-- END RHS Menu -->

Nov 18 '05 #1
1 5561
The error is due to an incorrectly closed <asp:Repeater> tag.

This tag is closed twice:

<asp:Repeater
ID="rptRHS_Menu"
Runat="Server" />

because it also has close tag </asp:Repeater> below it.

This should replace the corresponding block below:

<asp:Repeater
ID="rptRHS_Menu"
Runat="Server">
<ItemTemplate>
<ASP:HyperLink
ID="lnkItem"
Text='<%# Container.DataItem %>'
NavigateUrl='<%# string.Concat(vbPOST_BACK_FILE,
"?arc=", Container.DataItem %>'
Runat="Server" />
</ItemTemplate>
</asp:Repeater>

And a line added in Page_Load below the variable declarations:

aryDates = New ArrayList
On Wed, 30 Jun 2004 13:38:14 +0100, Zenobia
<6.**********@spamgourmet.com> wrote:
How do I bind an array, arrayList or even a stack to a repeater
containing hyperlinks.

The data structure (array, arrayList or even a stack) has dates
in ISO format "YYYY-MM-DD". The repeated hyperlinks will be
displayed, for example, in this form:

<a href='default.aspx?arc=2004-06-29'>2004-06-29</a>

or, better:

<a href='default.aspx?arc=2004-06-29'>June 29, 2004</a>

------ ------ ------ ------ ------
I get an error:
------ ------ ------ ------ ------

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

for this line:

Text='<%# Databinder.Eval((Container).DataItem) %>'

This is the Detailed Compiler Output:

target.Text = System.Convert.ToString(Container.DataItem[0])

PS 1: This page is made up of many controls and this is just one
of them. Some of the others already have Page_Load events.

PS 2: I've tried to change the line but each of the following
give the same error on the same line.

Text='<%# Container.DataItem %>'
Text='<%# Container.DataItem[0] %>'
Text='<%# (Container.DataItem)[0] %>'
Text='<%# Container.DataItem("Value") %>'
Text='<%# DataBinder.Eval( Container.DataItem[0] ) %>'
Text='<%# DataBinder.Eval( Container.DataItem("Value") ) %>'
Text='<%# DataBinder.Eval( Container.DataItem, "Value" ) %>'

PS 3: To make it easy for you I expect the ArrayList to look
something like this:

{"2004-05-19", "2004-06-29" }
------ ------ ------ ------ ------
Here is my control containing the code.
------ ------ ------ ------ ------

<%@ Import Namespace="System.IO" %>
<Script Runat="Server">

Const vbARCHIVE_FILENAME =
"2004_99_99_net-example_archive.xml"
Const vbPOST_BACK_FILE = "default.aspx"

Sub Page_Load(vbARCHIVE_FILENAME As String)

Dim aryFileNames As Array
Dim aryDates As ArrayList

Dim lenARCHIVE As Integer
Dim i As Integer
Dim fileName As String
Dim xmlFilePath As String
Dim strISODate As String

lenARCHIVE = Len(vbARCHIVE_FILENAME) - Len("2004-99-99")

xmlFilePath = Server.MapPath( "blogs/blog.xml" )
aryFileNames = Directory.GetFiles( Left(xmlFilePath,
Len(xmlFilePath)-8) )

For Each fileName in aryFileNames
If LCase(Right(fileName, lenARCHIVE)) =
Right(vbARCHIVE_FILENAME, lenARCHIVE) Then
aryDates.Add( Replace (Left(fileName, 10),"_", "-" ) )
End If
Next

rptRHS_Menu.DataSource = aryDates
rptRHS_Menu.DataBind()
End Sub

</Script>

<!-- Sidebar (RHS Menu) -->
<h6 title="older blogs">archives</h6>
<img src="images/pixel_gr.gif" height="2" width="130"><br />

<asp:Repeater
ID="rptRHS_Menu"
Runat="Server" />
<ItemTemplate>
<ASP:HyperLink
ID="lnkItem"
Text='<%# Container.DataItem[0] %>'
NavigateUrl='<%# string.Concat(vbPOST_BACK_FILE,
"?arc=", Container.DataItem[0] %>'
Runat="Server" />
</ItemTemplate>
</asp:Repeater>
<!-- END RHS Menu -->


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Nathan Sokalski | last post by:
I am using a DataSet as the DataSource of a DataList in my code. The SQL used to get the data from the database begins with: SELECT...
1
by: Nathan Sokalski | last post by:
When I run my application, which uses databinding in a DataList, I recieve the following error: Server Error in '/' Application. ...
0
by: fabrice | last post by:
Hello, I m using vb.net and framework 1.1 whithout VisualStudio. I'm trying to compile a personnal tool class in one assembly using VBC.exe . But i get an error in compilation and i don't know...
3
by: ericw3 | last post by:
I am switching from Java to the .Net framework. In order to separate page layout design from the application code, I studied the codebehind tutorial by John at...
3
by: Mauricio Pires | last post by:
All my pages work just fine on development, but as soon as I publish (deploy) to a W2K Server with .Net Framework 2.0 , I always get Compiler Error Message: BC30456: 'InitializeCulture' is not a...
1
by: Patrick.O.Ige | last post by:
Hi guys, I just moved a project from my pc to a server production (to an ISP). on my pc it all works fine with no errors. After fireing up the first page "default.aspx" i get the error...
7
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. I'm...
0
by: zykes | last post by:
can someone help me on this: This code worked on my other page but this one doesn't work on admin_golfCourse.aspx page. here's the code: <asp:DataGrid id="dbgridpres" runat="server"...
3
by: dancer | last post by:
I am using Framework 1.1.4322. Who can tell me why I'm getting this error? My code follows Compilation Error Description: An error occurred during the compilation of a resource required to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.