HOW TO DISPLAY TEXT IN AN MVC VIEW WITH HTMLATTRBUTES

Takeshi Okada

Total Post:89

Points:629
Posted by  Takeshi Okada
 1111  View(s)
Ratings:
Rate this:

I have the following code : 

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

I just want to display the text (with the correct htmlattribute) (i.e. no link) 

Could you help me with the correct syntax please?

  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: How to display text in an MVC view with htmlattrbutes

    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>

      Modified On Apr-07-2018 01:30:05 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!