Search code examples
c#htmlasp.net-mvcrazorbootstrap-4

@Html.Label is not displaying when content having dot (.) - Bootstrap MVC Razor


I am populating label text dynamically from database

     <div class="col-11 col-sm-11 col-md-11 col-lg-11 col-xl-11">
@Html.Label(@Model.Questions[i].DataText + ": ", new { @for = "dd" + @Model.Questions[i].DataTextId, @class = (@Model.QDataText[i].IsMandatory ? "required-field" : ""),Style= "white-space:normal; text-align: right;" })
</div>

But Label is not displaying while Label content contains a dot (.).Can anyone please help to fix the issue.Content that I am trying to display inside the label is as given below. For me it is showing only "In this" on the view.

"defines disrespect as an expression of lack of respect and a fashion that is generally disrespectful and contemptuous. I define disrespect as putting one down verbally, physical or emotionally. In this essay I will be talking about the research I did on article 88 and 91 of the uniformed code of military justice. Disrespect and insubordination in the army affects the ability of a unit to maintain discipline and order. The uniformed code ofshow more contentIt could also cause the soldier notdddefines disrespect as an expression of lack of respect and a fashion that is generally disrespectful and contemptuous. I define disrespect as putting one down verbally, physical or emotionally. In this"


Solution

  • I'd just stick with something like this:

    <label>@(Model.Questions[i].DataText): </label>