Converting SiteMapPathHelperModel Display Template to Vb

Oct 11, 2011 at 2:29 PM

Hi,

I have converted SiteMapPathHelperModel.cshtml to SiteMapPathHelperModel.vbhtml. Here is the 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> &gt; </text>
 
    End If
Next
When I run this I get error

Method 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
If I just do @Html.DisplayFor(Function(n) x.Title)
then the breadcrumbs comeup but just as text and not as links. So how in vb can I pass the whole node to DisplayFor
 
Oct 11, 2011 at 3:54 PM

I fixed it

@imports System.Web.Mvc.Html
@imports System.Linq
@imports MvcSiteMapProvider.Web.Html.Models
        
@ModelType SiteMapPathHelperModel
    
 
@For Each node In Model
 
    @Html.ActionLink(node.Title, Nothing, New With {.Controller = node.Controller, .action = node.Action})
    If node IsNot Model.Last() Then
            @<text> &gt; </text>
 
    End If
Next