jquery - MVC Razor DatePicker and TimePicker -
i have form generated razor allows users edit scheduler data, , works well.
one thing not understand, nor have seen before, date , time pickers automatically generated razor.
to clarify, these i'm talking about:
they're nice , all, can see in screenshot, do not use model values.
the markup has values set in tags, controls ignore them.
here's mean:
as can see, values set in tags, controls not respecting values.
i note in custom-built model, have these properties annotated following:
//for dates... [datatype(system.componentmodel.dataannotations.datatype.date)] //for time... [datatype(system.componentmodel.dataannotations.datatype.time)]
i prefer not have remove these annotations, if affects reaching solution, must done.
to solve this, i'd 1 of 2 things:
- prevent these controls being generated in first place can use this absolutely wonderful jquery datetimepicker addon.
- force these controls respect , display values passed in model.
all suggestions appreciated. suggestions made familiar mvc appreciated more.
render these using
@html.textboxfor( x => x.startdate, new { @class = "date" })
, use jquery$('.date').datetimepicker();
apply query plugin.the values
date
,time
inputs should in formatsyyyy-mm-dd
,hh:mm:ss
- explains why aren't working currently. haven't looked @ plugin want use closely, let configure date/time formats use.
Comments
Post a Comment