I have the following code :
@Html.ActionLink(\"Hello \" + User.Identity.GetUserName() + \"!\",
\"Manage\", \"Account\",
routeValues: null,
htmlAttributes: new
If i understand correctly,you want to show the text inside your link without an achor tag, but with your html attributes (title
attributes)
Try this
<span title="Manage">Hello @User.Identity.GetUserName() !</span>
I think you can use Url.Action method.
<a href="@Url.Action("ActionName")">
<span>"Hello " + User.Identity.GetUserName() + "!"</span>
</a>
If you want the text with no link i.e. no anchor element, then just use plain HTML
<span title="Manage">Hello @User.Identity.GetUserName()!</span>
Or if you don't want to enclose it within a <span>
<text>Hello @User.Identity.GetUserName()!</text>
But with this you won't get the title
attribute since the text is not enclosed within an html tag with which to apply it to.
If you actually want an anchor then you could also use @Url.Action()
in conjunction with plain HTML
<a title="Manage" href="@Url.Action("Manage", "Account")">
Hello @User.Identity.GetUserName()!
</a>