1

我尝试在 MVC 中使用 textboxfor 显示像 22.10.1984 这样的生日,但我不知道如何把它放在一起?

 @Html.TextBoxFor(model => model.DateOfBirthDay + "." + model => model.DateOfBirthYear + "." + model => model.DateOfBirthYear)
4

1 回答 1

1

如果您不想按照评论中的建议更改模型,则可以这样做:

@Html.TextBoxFor(model => string.Format("{0}.{1}.{2}", model.DateOfBirthDay, model.DateOfBirthMonth, model.DateOfBirthYear))
于 2015-10-22T08:27:12.023 回答