Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC VB.NET Razor
Hi Guys,
 
Does anyone know a tool that would convert razor syntax in a cshtml file to vbhtml file? Having trouble with all the lambda expressions.
Posted 6-Oct-12 4:30am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

As far as I can tell, the only tool you have is one between your ears. There is no automated conversion tool.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

@{
List menuList = ViewBag.Menu;
}
 

@helper RenderMenuItem(List menuList,MenuSample.Models.MenuModel mi)
{
foreach (var cp in menuList.Where(p => p.ParentId == mi.Id))
{


@:
  • @cp.Name

    if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
    {
    @:

      }

      @RenderMenuItem(menuList,cp)
      if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
      {
      @:
    }
    else
    {
    @:
  • }
    }
    }
      Permalink  
    Rate this: bad
    good
    Please Sign up or sign in to vote.

    Solution 4

    @{
    List menuList = ViewBag.Menu;
    }
     

    @foreach (var mp in menuList.Where(p => p.ParentId == 0)){
     
    @mp.Name
    @if( menuList.Count(p=>p.ParentId == mp.Id ) > 0){
    @:
    }
     
    @RenderMenuItem(menuList,mp)
     
    @if( menuList.Count(p=>p.ParentId == mp.Id ) > 0){
    @:
    }
     
    }

     
    @helper RenderMenuItem(List menuList,MenuSample.Models.MenuModel mi)
    {
    foreach (var cp in menuList.Where(p => p.ParentId == mi.Id))
    {
     

    @:
    @cp.Name
     
    if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
    {
    @:
     
    }
     
    @RenderMenuItem(menuList,cp)
    if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
    {
    @:
    }
    else
    {
    @:
    }
    }
    }
      Permalink  
    Comments
    Dave Kreskowiak at 12-Feb-14 10:13am
       
    Why are you responding to a question that's over a year old??
     
    Don't.

    This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

      Print Answers RSS
    0 OriginalGriff 390
    1 Jochen Arndt 150
    2 Richard MacCutchan 135
    3 DamithSL 95
    4 Garth J Lancaster 90
    0 OriginalGriff 6,045
    1 DamithSL 4,601
    2 Maciej Los 4,087
    3 Kornfeld Eliyahu Peter 3,480
    4 Sergey Alexandrovich Kryukov 3,260


    Advertise | Privacy | Mobile
    Web02 | 2.8.141220.1 | Last Updated 12 Feb 2014
    Copyright © CodeProject, 1999-2014
    All Rights Reserved. Terms of Service
    Layout: fixed | fluid

    CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100