Click here to Skip to main content
12,402,889 members (73,108 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 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  
    Comments
    Member 12299920 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
    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.160721.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