#MVC : Why does Html.Label() not work with periods? or Why is @Html.Label() removing some characters
You are misusing the Html.Label method. It is for:
Returns an HTML label element and the property name of the property that is represented by the specified expression.
That's why it gets confused if you have a point
. in the first parameter because it expects a property expression there.
However, you can use the second overload:
@Html.Label("", String.Format("{0}. someText",1))
Or just write out the HTML:
<label>@String.Format("{0}. someText", 1)</label>or
<label class="WelcomeText" style="float: left">Welcome @Html.Label("", Model.USERID + " ( " + Model.ROLE + " )", new { @class = "WelcomeText" })</label>
Comments
Post a Comment