|
-
Apr 11th, 2008, 02:44 PM
#1
[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 %>">
-
Apr 11th, 2008, 02:47 PM
#2
Re: [2005] C# to VB Conversion question
Try changing DataSource to DataSourceID and see if that helps.
(VB/C#) is clearly superior to (C#/VB) because it (has/doesn't have) <insert trivial difference here>.
-
Apr 11th, 2008, 02:50 PM
#3
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.
-
Apr 11th, 2008, 02:57 PM
#4
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?
-
Apr 11th, 2008, 03:03 PM
#5
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 %>"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|