如何在htmlattrbutes一个MVC视图中显示的文本 [英] How to display text in an MVC view with htmlattrbutes

查看:158
本文介绍了如何在htmlattrbutes一个MVC视图中显示的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code:

@Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", 
"Manage", "Account", 
routeValues: null, 
htmlAttributes: new { title = "Manage" })

我只是想显示的文字(用正确的htmlattribute)(即没有链接

你能不能帮我正确的语法吗?

Could you help me with the correct syntax please?

推荐答案

如果我理解正确的,你想展示你的链接中的文本没有阿克尔标签,但你的HTML属性(标题属性)

If i understand correctly,you want to show the text inside your link without an achor tag, but with your html attributes (title attributes)

试试这个

<span title="Manage">Hello @User.Identity.GetUserName() !</span>

这篇关于如何在htmlattrbutes一个MVC视图中显示的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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