Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

As far as I can tell, the only tool you have is one between your ears. There is no automated conversion tool.
 
Share this answer
 
@{ List<menusample.models.menumodel> menuList = ViewBag.Menu;
}



@helper RenderMenuItem(List<menusample.models.menumodel> 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
    {
    @:
  • }
    }
    }
     
    Share this answer
     
    Comments
    Tom@Austria 13-Mar-16 17:02pm    
    Hi ToanLC

    I also have a Problem to Convert some Code..

    Here is My Problem, maybe you have a hint for my "is" Problem


    @if (@Model is HelperResult)
    {
    @Model
    }
    else
    {
    <div class="pull-right">
    @Html.Partial("_TopRight")
    </div>
    }


    and here is my try:


    @Code If (@Model ??Need Help?? HelperResult)
    @Model
    Else
    @<div Class="pull-right">
    @Html.Partial("_TopRight")
    </div>
    End If
    End Code


    thx a lot
    @{ 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
    {
    @:
    }
    }
    }
     
    Share this answer
     
    Comments
    Dave Kreskowiak 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)



    CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900