Roc*_*Ron 5 asp.net-mvc header actionlink razor graphical-logo
我正在努力使用MVC(4)的Razor语法,希望能找到一个可以帮助我找到一个好的工作解决方案的人.
我想要一个可点击的徽标(图像)并创建以下代码.除了两件事之外,这有效.我没有看到图像显示,其次,在其他控制器中,路由出错(http4错误).
这就是我现在的表现:
剃刀:
<h1>@Html.ActionLink("siteHeader", "Index", null, new { @class = "site-logo"})</h1>
Run Code Online (Sandbox Code Playgroud)
要么
<h1>@Html.ActionLink("siteHeader", "Index", "Home", new { @class = "site-logo"})</h1>
Run Code Online (Sandbox Code Playgroud)
例如,当在不同的控制器(account/shoppingcart/etc.)中并点击徽标时,它会产生404.
CSS:
/ Site HeaderLogo /
a.site-logo {
background: url(images/Solosoft.png) no-repeat top left;
display: block;
width: 100px;
height: 100px;
text-indent: -9999px; /*hides the link text*/
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
尝试这个:
@Html.ActionLink("siteHeader", "Index", "Home", null, new { @class = "site-logo"})
Run Code Online (Sandbox Code Playgroud)
这是:
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
string controllerName,
Object routeValues,
Object htmlAttributes
)
Run Code Online (Sandbox Code Playgroud)
链接:msdn
| 归档时间: |
|
| 查看次数: |
24074 次 |
| 最近记录: |