You can use the standard ASP.NET features in your MVC views. In this case, you call the String.Format method to display the UnitPrice field in a suitable form for a monetary amount. You just pass in the Model.UnitPrice value as the argument to the method call.
<%= String.Format(“{0:F2}”, Model.UnitPrice) %>
String class can also be used as a formatter in thextbox:
Unit Price:
<%: Html.TextBoxFor(model => model.UnitPrice, new {Value = String.Format(“{0:F2}”, Model.UnitPrice)})%>
<%: Html.TextBoxFor(model => model.UnitPrice, new {Value = String.Format(“{0:F2}”, Model.UnitPrice)})%>