1
这是窃听我,我不知道发生了什么。我创建了一个局部视图来正确地格式化一个数字。为什么我的部分视图不起作用?
文件_PermitNumber.cshtml
为/Views/Shared
,包含:
@model System.Int32
@Html.Raw(Model.ToString("00-0000"))
在我的主网页我做的:
@Html.DisplayFor(model => model.BuildingPermit.PermitId, "_PermitNumber")
model.BuildingPermit.PermitId
被定义为int
。
我的输出是120456而不是预期的12-0456。
这是怎么回事?
Doh!我应该在模型中做到这一点......谢谢! –