[RESOLVED] [2005] C# to VB Conversion question
The below line was in the markup of a C# asp.net page, what would be the equivalent in VB? The datasource item is what I need. The code behind file converted fine, but this line is giving me an error of "The DataSource property cannot be set declaratively". No matter what I try to set it to, it doesn't seem to like the fact that you are using code for that property, but it does work in C#.
Code:
<asp:Repeater ID="Repeater1" runat="server" DataSource="<% ((SiteMapNode) Container.DataItem).ChildNodes %>">
Re: [2005] C# to VB Conversion question
Try changing DataSource to DataSourceID and see if that helps.
Re: [2005] C# to VB Conversion question
But datasourceID would be the name of a defined datasource, correct? It looks like they are using the actual nodes of an object there, in an undefined datasource, so you can't reference it by an ID.
Re: [2005] C# to VB Conversion question
Im thinking its a cast statement, so the equivalent line would be something like
Code:
<% DirectCast(Container.DataItem, SiteMapNode).ChildNodes %>
or by using CType, but no matter what I put VB doesn't like it and won't compile with the error stated in the first post. Can you not do this in VB?
Re: [2005] C# to VB Conversion question
Hehe... I forgot the '#' symbol after the opening tag... that was the problem...
Code:
DataSource="<%# DirectCast(Container.DataItem, SiteMapNode).ChildNodes %>"