如何用图标生成Html.ActionLink [英] how to generate Html.ActionLink with icon

查看:161
本文介绍了如何用图标生成Html.ActionLink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习ASP.NET MVC,并且遇到了一个问题:如何使用 Html.ActionLink 生成代码如下所示:

 < a href =〜/ Views / Home / Create.cshtmlclass =btn btn-primary> 
< i class =icon-pencil icon-white>< / i>
< span>
< strong>创建< / strong>
< / span>
< / a>


解决方案

您应该使用 code>< a href =@ Url.Action(...)> 用于更复杂的链接。


I'm starting to learn ASP.NET MVC, and have a problem, how generate code with Html.ActionLink like this:

<a href="~/Views/Home/Create.cshtml" class="btn btn-primary">
    <i class="icon-pencil icon-white"></i>
    <span>
        <strong>Create</strong>
    </span>            
</a>

please.

解决方案

Html.ActionLink() only supports plain-text links.

You should use <a href="@Url.Action(...)"> for more-complex links.

这篇关于如何用图标生成Html.ActionLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆