Format @ Html.Label - MVC

4

In my page I have one:

@Html.ActionLink(linkText: "Bem Vindo(a) " + User.Identity.GetUserName() + "!", actionName: "Index", controllerName: "RelatorioTagModels1")

What it generates, the "Welcome" page below:

ButIdonotwantittobealink,IjustwantedaLabel,soIchangedthecodeto:

@Html.Label("Bem Vindo(a) " + User.Identity.GetUserName() + "!");

However, I can not format, leave the same as the previous page:

Is it right to use @Html.Label ? for this? How should I format to visually leave @Html.ActionLink ?

    
asked by anonymous 19.02.2017 / 02:36

1 answer

2

The problem is that your CSS has something that formats this line based on the <a> tag of HTML Link to CSS Nested

Example:

.Topo{}
.Topo a { aqui está o codigo que alinha e deixa branco}

So when you put it without <a href it went without formatting. (it did not even get called the nested css)

3 suggestions:

1. Disable CSS for <A> and change to custom Ex:

.Topo a {}

You will replace with:

.MinhaClass{ mesmo código do de cima}

and you'll call it like this:

@Html.ActionLink(linkText: "Bem Vindo(a) " + User.Identity.GetUserName() + "!", actionName: "Index", controllerName: "RelatorioTagModels1", new with {.class = "MinhaClass" })

* NOTE: For you to find which class you use the 'inspect' of your browser, it will show which css it is.

2. Leave with <a> but disable the click

Create the following css:

.disabled {
   pointer-events: none;
   cursor: default;
}

You just need to call this disable:

@Html.ActionLink (linkText: "Welcome") + User.Identity.GetUserName () + "!", actionName: "Index", controllerName: "ReportTagModels1", new with {.class="disabled "})

3. Create a style that corrects the label something like:

.LabelNome{
    position: relative;
    top: 20px;
    color: white;
}

and then you call that LabelNome equal to the above examples

new with {.class = "LabelNome"

NOTE: It may be necessary to change the value 20px

    
17.07.2017 / 18:10