Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 基于URL属性定义所选菜单选项_C#_Css_Asp.net Mvc_Razor - Fatal编程技术网

C# 基于URL属性定义所选菜单选项

C# 基于URL属性定义所选菜单选项,c#,css,asp.net-mvc,razor,C#,Css,Asp.net Mvc,Razor,我在razor View MVC中有一个菜单: @Html.ActionLink("Criar Nova", "Create", new { tipo = Request.Params["tipo"] }) @Html.ActionLink("Listar Todas", "Index", new { tipo = @ViewBag.ENTIDADE_LISTAR_TODAS }) @Html.ActionLink("Listar Expedidoras", "Index", new { tip

我在razor View MVC中有一个菜单:

@Html.ActionLink("Criar Nova", "Create", new { tipo = Request.Params["tipo"] })
@Html.ActionLink("Listar Todas", "Index", new { tipo = @ViewBag.ENTIDADE_LISTAR_TODAS })
@Html.ActionLink("Listar Expedidoras", "Index", new { tipo = @ViewBag.ENTIDADE_LISTAR_TIPO_EXP })
@Html.ActionLink("Listar Destinatárias", "Index", new { tipo = @ViewBag.ENTIDADE_LISTAR_TIPO_DEST })
视图的URL类似于www.xxx.com?tipo=YYY

如何在基于YYY值的ActionLink文本中设置粗体样式


谢谢。

假设您知道如何剥离url并获取字符串变量,您可以在html链接本身中使用粗体来分配css类

<head>
   <style>
   .activeMenu{font-wieght:bold;}
   </style>
</head>

@Html.ActionLink("Criar Nova", "Create", new { tipo = Request.Params["tipo"] }, new { @class = "activeMenu"})

.activeMenu{font-wieght:bold;}
@ActionLink(“Criar Nova”,“Create”,new{tipo=Request.Params[“tipo”]},new{@class=“activeMenu”})

您好,谢谢,但是我如何才能将.Params值设置为插入类属性的正确选项?