Given this html code:
@Html.TextBoxFor(x => x.CountryName, new { placeholder = "Country", @class = "input-medium", customerui = "Country" })
@Html.DisplayText( " [ " )
@Html.DisplayTextFor(x => x.CountryName )
@Html.DisplayText( " ] " )
@Html.DisplayTextFor(x => x.CountryFootnote)
The expectation is that the following would be shown:
But instead the " [ " and " ] " are missing?
I did search last night and did not find @Html.DisplayText will not actually display text Which explains my posting this question.
The helpful answer is:
The DisplayText is synonomous for Model.PropertyName.. so Model.PropertyName = @Html.DisplayText('PropertyName')
So if ' [ ' and ' ] ' are not attributes of your model and you are just trying to output raw text then just replace the 'DisplayText' statements with the raw text:
<text> [ </text>
@Html.DisplayTextFor(x => x.CountryName )
<text> ] </text>