Reputation: 19
@if (Model.IsPersonal)
{
@Html.TextBoxFor(model => model.FirstName, new { style = "width:70px;height:10px;" })
}
else
{
@Html.DisplayFor(model => model.FirstName)
@Html.DisplayFor(model => model.LastName)
}
I am used above code in MVC 3.0 razor view engine space the first name and last name but &nbps does not work please help me?
Upvotes: 1
Views: 222
Reputation: 54359
One way to resolve it:
<text> </text>
Even though you are inside a code block, this tells the Razor engine to treat it as literal, unprocessed content.
You can also use the syntax @:
See also: http://weblogs.asp.net/scottgu/archive/2010/12/15/asp-net-mvc-3-razor-s-and-lt-text-gt-syntax.aspx
Whether or not you should actually use a non-breaking space here is a different question.
Upvotes: 3