我有两列,分别是Year和Month。所以我把它放在桌子上:
@Html.DisplayFor(modelItem => item.Year) - @Html.DisplayFor(modelItem => item.Month)结果为:2019-1,2019-2,2019-3,ff。
我想将表上的视图更改为:1901、1902、1903
我怎样才能做到这一点?
谢谢。
发布于 2019-09-26 08:01:48
您可以尝试这样做(假设年份和月份是字符串,如果不是字符串,请添加.ToString()):
@Html.DisplayFor(modelItem => item.Year.Substring(2) + item.Month.PadLeft(2, '0'))https://stackoverflow.com/questions/58110819
复制相似问题