MVC.NET milliseconds get lost when using Html.hidden on a DateTime LastUpdated column for version tracking

后端 未结 5 1954
小鲜肉
小鲜肉 2021-01-12 15:30

Question in short:

How tot do this in MVC.NET?

Question in long version:

Im trying to use a DateTime column in a SQL Table for version tracking (this

5条回答
  •  花落未央
    2021-01-12 15:52

    If you don't want to use Ticks, TextBoxFor will work if you specify the date format and the html hidden attribute.

    @Html.TextBoxFor(model => model.CreatedDate, "{0:dd/MM/yyyy HH:mm:ss.fff}", htmlAttributes: new { @type = "hidden" })
    

提交回复
热议问题