我从基类派生控制器:
namespace merawi.Controllers
{
public class BaseController : Controller
{
public CultureInfo trTR = new CultureInfo("tr-TR");
public BaseController()
{
trTR.NumberFormat.CurrencySymbol = "TL";
}
}
}
并使用此语句格式化货币:
ViewBag.SellingPrice = sp.ToString("C", trTR);
但是,在具有视图模型的视图中
@model List<merawi.Models.DocumentWorkStep>
我需要一种根据需要格式化货币的方法。
SellingPrice
是DocumentWorkStep
类中的十进制字段:
public Nullable<decimal> SellingPrice { get; set; }
并使用这个
<td>@string.Format("{0:C}", res.SellingPrice)</td>
输出₺,我需要“TL”
我需要一种从视图文件中访问 trTR 对象的方法...
谢谢