Click here to Skip to main content
12,071,956 members (61,485 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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 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
    Top Experts
    Last 24hrsThis month


    Advertise | Privacy | Mobile
    Web01 | 2.8.160208.1 | Last Updated 12 Feb 2014
    Copyright © CodeProject, 1999-2016
    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