c# - saving date time exception -
i have class callnote contain entity
[datatype(datatype.date)] [displayformat(dataformatstring = "{0:yyyy-mm-dd}", applyformatineditmode = true)] public datetime callbackdate { get; set; }
and controller like:
[httppost] public actionresult createnote(callnote callnote) { yelloadmindbcontext db = new yelloadmindbcontext(); if (modelstate.isvalid) { db.note.add(callnote); //var temp = db.note.find(feedback); //db.savefeedback.add(new savefeedback { loginid = id, feedback = temp }); db.savechanges(); return redirecttoaction("callhistory"); //return javascript("alert('success');"); } return view("callhistory", callnote); }
and in view:
<div class ="editor-label"> @html.editorfor(item => item.callbackdate) @*@html.validationmessagefor(item => item.callbackdate)*@ </div>
i getting exception:
the conversion of datetime2 data type datetime data type resulted in out-of-range value. statement has been terminated.
how can resolve exception?
Comments
Post a Comment