Reputation: 11
the doubt is this:
I have to use a <a></a>
, because of the notation I'm using in all my app, I'm working in ASP.NET MVC. So, I have an href="@Url.Action
with class="btn btn-primary"
, a simple button as this:
<a href="@Url.Action("Manage", "Account")" class="btn btn-primary text-right">
<span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Administrar
</a>
(That was an example of the estructure that I need)
But now I have to convert this:
@Html.ActionLink(User.Identity.GetUserName(), "Manage", "Account",
routeValues: null, htmlAttributes: new { title = "Administrar" })
to that estructure. The fact is, I don't know where to put the routevalues
and User.Identity.GetUserName()
. I don't need the htmlAttributes
neither the title.
Please help me and thanks a lot.
Upvotes: 1
Views: 8744
Reputation: 371
I suppose you have Html.Actionlink like bellow
@Html.ActionLink("Home", "index", null, new { @class = "btn btn-primary" })
all you need to do is to write it like this
<a class="brand" href="@Url.Action("index","Home")"> </a>
and you are done!
Upvotes: 0
Reputation: 62260
For title, you just simple use title="Administrar"
, so when you hover mouse on the button/link, it'll still show Administrar
in tool-tip.
For Username, you will need @
sign at the front.
<a href="@Url.Action("Manage", "Account")" class="btn btn-primary text-right"
title="Administrar">
<i class="fa fa-arrow-circle-left" aria-hidden="true"></i>
@User.Identity.GetUserName()
</a>
Another suggestion is not to use Bootstrap's glyphicon, because they won't be available in next version anymore. Instead, you might want to consider using Font Awesome.
Upvotes: 1
Reputation: 12491
It should be:
<a href="@Url.Action("Manage", "Account")" class="btn btn-primary text-right">
<span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span>
@User.Identity.GetUserName()
</a>
routevalues
will be next parameter in Url.Action
method if you need it.
Like this:
Url.Action("Manage", "Account", new { id = 1 })
Upvotes: 0