ASP.NET MVC - Label does not display because of the "dot" character at the end of the name parameter

1

I had a problem where a label did not appear on the page I was creating with Razor.

I discovered that the problem was because the parameter "string name" had a dot at the end. I would like to know if this is an ASP.NET bug or if you have some logical explanation for this problem.

My error code is as follows:

<div class="form-group">
    @Html.Label("Codigo Aut.", htmlAttributes: new { @class = "control-label col-md-1" })
    <div class="col-md-2">
        @Html.TextBox("pesquisaCodigoAutorizacao", null, new { @class = "form-control input-md" })
    </div>
</div>

When I remove the "Aut." which I had used to abbreviate the word "Authorization," then the label is usually displayed.

<div class="form-group">
    @Html.Label("Codigo Aut", htmlAttributes: new { @class = "control-label col-md-1" })
    <div class="col-md-2">
        @Html.TextBox("pesquisaCodigoAutorizacao", null, new { @class = "form-control input-md" })
    </div>
</div>
    
asked by anonymous 30.11.2017 / 21:12

1 answer

2

The Html.Label there are overloads and the one you need to use in your code is next strong>:

@Html.Label("CA", "Codigo Aut.", htmlAttributes: new { @class = "control-label col-md-1" })

show questions with the tag 'html' "> html of for and Auth description of your <label> , and the output of that code :

<label class="control-label col-md-1" for="CA">Codigo Aut.</label>

30.11.2017 / 21:31