I have an ASP.NET MVC App. I am building an HTML table using razor syntax. The page model is defined as
@model IEnumerable < DealView.Models.deal >
and the model has a property
public string price { get; set; }
which can be a number or null.
I am trying to get the textbox for to show comma's (ie 1,000,000) or even better currency ($1,000,000). At the moment I am just getting (1000000) using
@foreach (var item in Model)
{
<tr>
...
<td>@Html.TextBoxFor(modelItem => item.price, new { id = string.Format("
{0}_price", item.ID) })</td>
...
</tr>
}
I have tried item.price.asint()
but think the null instances causes problems. Any advice is appreciated. I am not married to the TextBoxFor
if there is a better helper function to use.