Z
Zenobia
Hello folks,
How do I bind an array to a repeater?
or bind an array to a hyperlink (which is repeated inside a
repeater) ?
I get this message:
Compiler Error Message: BC30456: 'DataItem' is
not a member of 'System.Web.UI.Control'.
for line below that begins with <li>
This is my simplified example code. I have included 2 examples
both of which fail.
+++ +++ +++ +++
<Script Runat="Server">
Sub Page_Load()
Dim aryDates() As String = {"2004-07-04", "2004-07-05",
"2004-07-06"}
rptRHS_Menu.DataSource = aryDates
rptRHS_Menu.DataBind()
End Sub
</Script>
<html>
<body>
<asp:Repeater
ID="rptRHS_Menu"
Runat="Server" />
<ItemTemplate>
<li><a href="<%# String.Concat( Container.DataItem,
".html") %>"><%# Container.DataItem %></a></li>
</ItemTemplate>
</asp:Repeater>
</body>
</html>
+++ +++ +++ +++
<Script Runat="Server">
Sub Page_Load()
Dim aryDates As ArrayList
aryDates = New ArrayList
aryDates.Add ("2004-07-04")
aryDates.Add ("2004-07-05")
aryDates.Add ("2004-07-06")
aryDates.Reverse
rptRHS_Menu2.DataSource = aryDates
rptRHS_Menu2.DataBind()
End Sub
</Script>
<html>
<body>
<form Runat="Server">
<asp:Repeater
ID="rptRHS_Menu2"
Runat="Server" />
<ItemTemplate>
<li>
<a href='<%# String.Format( "{0}.html",
Container.DataItem ) %>'><%# String.Format( "{0}",
Container.DataItem) %></a>
</ItemTemplate>
</asp:Repeater>
</form>
</body>
</html>
How do I bind an array to a repeater?
or bind an array to a hyperlink (which is repeated inside a
repeater) ?
I get this message:
Compiler Error Message: BC30456: 'DataItem' is
not a member of 'System.Web.UI.Control'.
for line below that begins with <li>
This is my simplified example code. I have included 2 examples
both of which fail.
+++ +++ +++ +++
<Script Runat="Server">
Sub Page_Load()
Dim aryDates() As String = {"2004-07-04", "2004-07-05",
"2004-07-06"}
rptRHS_Menu.DataSource = aryDates
rptRHS_Menu.DataBind()
End Sub
</Script>
<html>
<body>
<asp:Repeater
ID="rptRHS_Menu"
Runat="Server" />
<ItemTemplate>
<li><a href="<%# String.Concat( Container.DataItem,
".html") %>"><%# Container.DataItem %></a></li>
</ItemTemplate>
</asp:Repeater>
</body>
</html>
+++ +++ +++ +++
<Script Runat="Server">
Sub Page_Load()
Dim aryDates As ArrayList
aryDates = New ArrayList
aryDates.Add ("2004-07-04")
aryDates.Add ("2004-07-05")
aryDates.Add ("2004-07-06")
aryDates.Reverse
rptRHS_Menu2.DataSource = aryDates
rptRHS_Menu2.DataBind()
End Sub
</Script>
<html>
<body>
<form Runat="Server">
<asp:Repeater
ID="rptRHS_Menu2"
Runat="Server" />
<ItemTemplate>
<li>
<a href='<%# String.Format( "{0}.html",
Container.DataItem ) %>'><%# String.Format( "{0}",
Container.DataItem) %></a>
</ItemTemplate>
</asp:Repeater>
</form>
</body>
</html>