Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Html.Raw is not working in razor view page

$
0
0

Hi,

Html.Raw is not working in razor view page. I couldn't add quotes example: class="dropdown-submenu"

I have this page "Views/Shared/Components/Default.cshtml" for navbarmenu

I tried this "Html.Raw"

<li@((subMenuCount==0)?"": "class=" + Html.Raw("\"") + "dropdown-submenu" +  Html.Raw("\"") )>

I got this

<li class=&quot;dropdown-submenu&quot;>

this page is working but it doesn't have quotes 

<li class=dropdown-submenu><a class=dropdown-toggle data-toggle=dropdown href=# >SubMenu2</a>
@model NavbarMenuModel
@*  S U B M E N U *@

@{
    var subMenuCount = 0;
}

@foreach (var subMenu in Model.SubMenus.OrderBy(i => i.SortOrder))
{
    subMenuCount = Model.AllMenu.Where(c => c.ParentId == subMenu.MenuId).Count();<li@((subMenuCount==0)?"":" class=dropdown-submenu")><a @((subMenuCount == 0) ? "href=/" + subMenu.Controller + "/" + subMenu.Action + "" : "class=dropdown-toggle data-toggle=dropdown href=# ")>@subMenu.Name</a>
        @if (subMenuCount > 0)
        {<ul class="dropdown-menu">
                @await Component.InvokeAsync("NavbarSubMenu", subMenu.MenuId)</ul>
        }</li>
}

how can I use quotes in a Component page 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>