Converting from C# to Vb MvcSiteMapProvider

convertion , csharp , vb United States
  • 6 years ago

    Hi,

    I have converted SiteMapPathHelperModel.cshtml to SiteMapPathHelperModel.vbhtml. Here is the

    C# Code
    @model MvcSiteMapProvider.Web.Html.Models.SiteMapPathHelperModel
    @using System.Web.Mvc.Html
    @using System.Linq
    @using MvcSiteMapProvider.Web.Html.Models
    
    @foreach (var node in Model) { 
        @Html.DisplayFor(m => node);
    
        if (node != Model.Last()) {
            <text> > </text>
        }
    }
    
    VB Code
    @imports System.Web.Mvc.Html
    @imports System.Linq
    @imports MvcSiteMapProvider.Web.Html.Models
    
    @ModelType SiteMapPathHelperModel
    
    
    @For Each node In Model
    
        Dim x As SiteMapNodeModel = node
        @Html.DisplayFor(Function(n) x)    
        If node IsNot Model.Last() Then
                @<text> > </text>
    
        End If
    Next
    

    When I run this I get errorMethod not found: 'Void System.Web.Mvc.WebFormView..ctor(System.String, System.String)'.The error happens on @Html.DisplayFor(Function(n) x) in C sharp this line is @Html.DisplayFor(m => node);What is the equivalent of this in VB

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.” - Alan Kay