Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • CodeMaster2008 151 posts 184 karma points
    Dec 08, 2012 @ 02:22
    CodeMaster2008
    0

    Razor Macro - 'Property' is not a member of 'System.Web.UI.WebControls.Parameter

    While playing around with 4.11.1 I noticed that under "Scripting Files" I can create a new razor script based on C# or VB.NET, so I went ahead and put the VB.NET option to a test, assuming that if it's there it is supported.

    First of all I created a c# script based on the "Navigation" template.
    It worked just fine.
    After that I created a new script, this time based on VB.NET and ported the navigation template to VB.NET.
    When I try to save it I get this error:

    C:\[InstallFolder]\macroScripts\634905081306513672_MainNavigationVB.vbhtml(28): error BC30456: 'Level' is not a member of 'System.Web.UI.WebControls.Parameter'.

    Here is the Navigation templated ported to VB.NET:

    @Inherits umbraco.MacroEngines.DynamicNodeContext
    @Code
    
    
    
        Dim level = If(String.IsNullOrEmpty(Parameter.Level), 1, Integer.Parse(Parameter.Level))
        Dim ulClass = If(String.IsNullOrEmpty(Parameter.UlClass), "", String.Format(" class='{0}'", Parameter.UlClass))
        Dim parent = Model.AncestorOrSelf(level)
        If Not IsNothing(parent) then
            @<ul @Html.Raw(ulClass)>
                @For Each item In parent.Children.Where("Visible")
                    Dim selected = If(Array.IndexOf(Model.Path.Split(","), item.Id.ToString()) >= 0, " class='selected'", "")
                    @<li @Html.Raw(selected)>
                        <a href="@item.Url">@item.Name</a>
                     </li>
                Next                    
            </ul>
        End If
    
    End Code
    

    Looks like the VB.NET code is not grabbing the Parameter property as the C# one does. 
    So, what am I missing? 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 08, 2012 @ 14:02
    Jeroen Breuer
    0

    Hmm I'm no VB.NET expert. If it's a bug it's best to report it here: http://issues.umbraco.org

    If you want to use Razor in 4.11 it's better to use the new MVC render engine. Your templates will become views than. More info here: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft