Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVCVB.NETRazor
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 3: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
    Your Filters
    Interested
    Ignored
         
    0 Shai Vashdi 1,858
    1 OriginalGriff 278
    2 Tadit Dash 260
    3 Sergey Alexandrovich Kryukov 250
    4 Peter Leow 220
    0 Sergey Alexandrovich Kryukov 9,530
    1 OriginalGriff 5,711
    2 Peter Leow 4,320
    3 Maciej Los 3,540
    4 Abhinav S 3,373


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