asp.net mvc - Disable Editor Template Date.cshtml on specific view -
asp.net mvc - Disable Editor Template Date.cshtml on specific view -
my model
[datatype(datatype.date, errormessage = "please come in valid date in format mm/dd/yyyy")] [displayformat(dataformatstring = "{0:d}", applyformatineditmode = true)] [display(name = "from date")] public datetime fromdate { get; set; }
my view
@html.editorfor(model => model.fromdate)
my date.cshtml (editor templates)
@html.textbox("", string.format("{0:mm/dd/yyyy}", datetime.now), new { @class = "datefield", type = "date" })
my requirement show database value on particular view every time shows me current date. how please help me.
you should utilize model
instead of datetime.now
@html.textbox("", string.format("{0:mm/dd/yyyy}", model), new { @class = "datefield", type = "date" })
asp.net-mvc razor view editortemplates
Comments
Post a Comment