I figured it out. Apparently, CType is a Visual Basic Thing.
((SiteMapNode)Container.DataItem).ChildNodes
fixed.
Вопрос
I have the following markup in my .aspx page:
<ul>
<li><asp:HyperLink ID="lnkHome" NavigateUrl="~/Default.aspx" Text="Home" runat="server" /></li>
<asp:Repeater id="navRepeater" runat="server" DataSourceID="SMDS1" EnableViewState="false">
<ItemTemplate>
<li>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
<asp:Repeater ID="Repeater1" runat="server" DataSource='<%# CType(Container.DataItem, SiteMapNode).ChildNodes %>'>
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
And when I try to compile it I get this:
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: CS0103: The name 'CType' does not exist in the current context
I literally got this code right off of the MSDN website. Has anyone any idea why it would be giving me this issue? Site is in C#, if that information helps.
Решение
I figured it out. Apparently, CType is a Visual Basic Thing.
((SiteMapNode)Container.DataItem).ChildNodes
fixed.