Kendo dateTimePickerFor sending NULL or 01/01/0001 00:00 to controllerHow can I get the Kendo UI MVC datetimepicker to format the date unambiguously in the URL/form?Sending email in .NET through GmailASP.NET C# DateTime Models/Controller/View FormatData Annotations to Entity Framework generated classDateTimePicker + WPF + binding + accept dd/MM/yyyy via userinputmvc bootstrap datepicker with editor template not workingASP.NET MVC 5 Scaffolding not creating elements for enum propertyHow to use datetime picker as editortemplateHow to filter DropDown list by logged in User in MVCHow to format Date, Time, Number in ASP.NET Core 2.0, RAZOR Tag HelpersHow to save list of children with its parent in Kendo UI MVC?

Relevance of the Resurrection

If you have multiple situational racial save bonuses and are in a situation where they all apply do they stack?

Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?

How to save PDFs from web for offline reading on an iPad?

Where can I find vomiting people?

How do email clients "send later" without storing a password?

Defining a function which returns a function pointer which also returns a function pointer without typedefs

Insert str into larger str in the most pythonic way

How to stabilise the bicycle seatpost and saddle when it is all the way up?

Why do sellers care about down payments?

How do I politely hint customers to leave my store, without pretending to need leave store myself?

What is the standard practice in Constraint Programming modeling?

Can I say "I have encrypted something" if I hash something?

Does the amount of +1/+1 from *prowess* remain on a creature, even when a creature gets flipped face-down by Ixidron?

How does Vivi differ from other Black Mages?

What does "synoptic" mean in avionics?

Can a magnet rip protons from a nucleus?

My employer wants me to do a work of 6 months in just 2 months

Which ping implementation is Cygwin using?

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

Do ibuprofen or paracetamol cause hearing loss?

Is there a standard terminology for female equivalents of terms such as 'Kingdom' and if so, what are the most common terms?

Kerning feedback on logo

Converting multiple assignment statements to single comma separated assignment



Kendo dateTimePickerFor sending NULL or 01/01/0001 00:00 to controller


How can I get the Kendo UI MVC datetimepicker to format the date unambiguously in the URL/form?Sending email in .NET through GmailASP.NET C# DateTime Models/Controller/View FormatData Annotations to Entity Framework generated classDateTimePicker + WPF + binding + accept dd/MM/yyyy via userinputmvc bootstrap datepicker with editor template not workingASP.NET MVC 5 Scaffolding not creating elements for enum propertyHow to use datetime picker as editortemplateHow to filter DropDown list by logged in User in MVCHow to format Date, Time, Number in ASP.NET Core 2.0, RAZOR Tag HelpersHow to save list of children with its parent in Kendo UI MVC?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















The view is working correctly and I can see the datetimepicker but when I click submit the datetime fields are null (if nullable) or 01/01/0001 00:00 if not nullable.



View



<div class="form-group">
@Html.LabelFor(model => model.LaycanStartDate, htmlAttributes: new @class = "control-label col-md-12" )
<div class="col-md-10">
@Html.EditorFor(model => model.LaycanStartDate, new htmlAttributes = new @class = "form-control" )
@Html.ValidationMessageFor(model => model.LaycanStartDate, "", new @class = "text-danger" )
</div>
</div>

<script>
$(function ()
$.validator.methods.date = function (value, element)
);
</script>


Model



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy HH:mm")]
public DateTime LaycanStartDate get; set;


DateTime.cshtml



@model DateTime? 
@(Html.Kendo().DateTimePickerFor(m => m).HtmlAttributes(new style = "width: 100%; max-width: 280px", title = "datetimepicker"))









share|improve this question





















  • 2





    This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

    – Panagiotis Kanavos
    Mar 28 at 9:05






  • 2





    A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

    – Panagiotis Kanavos
    Mar 28 at 9:06











  • Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

    – Evan Barke
    Mar 28 at 9:52











  • Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

    – Panagiotis Kanavos
    Mar 28 at 9:53






  • 1





    Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

    – Panagiotis Kanavos
    Mar 28 at 10:06

















0















The view is working correctly and I can see the datetimepicker but when I click submit the datetime fields are null (if nullable) or 01/01/0001 00:00 if not nullable.



View



<div class="form-group">
@Html.LabelFor(model => model.LaycanStartDate, htmlAttributes: new @class = "control-label col-md-12" )
<div class="col-md-10">
@Html.EditorFor(model => model.LaycanStartDate, new htmlAttributes = new @class = "form-control" )
@Html.ValidationMessageFor(model => model.LaycanStartDate, "", new @class = "text-danger" )
</div>
</div>

<script>
$(function ()
$.validator.methods.date = function (value, element)
);
</script>


Model



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy HH:mm")]
public DateTime LaycanStartDate get; set;


DateTime.cshtml



@model DateTime? 
@(Html.Kendo().DateTimePickerFor(m => m).HtmlAttributes(new style = "width: 100%; max-width: 280px", title = "datetimepicker"))









share|improve this question





















  • 2





    This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

    – Panagiotis Kanavos
    Mar 28 at 9:05






  • 2





    A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

    – Panagiotis Kanavos
    Mar 28 at 9:06











  • Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

    – Evan Barke
    Mar 28 at 9:52











  • Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

    – Panagiotis Kanavos
    Mar 28 at 9:53






  • 1





    Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

    – Panagiotis Kanavos
    Mar 28 at 10:06













0












0








0








The view is working correctly and I can see the datetimepicker but when I click submit the datetime fields are null (if nullable) or 01/01/0001 00:00 if not nullable.



View



<div class="form-group">
@Html.LabelFor(model => model.LaycanStartDate, htmlAttributes: new @class = "control-label col-md-12" )
<div class="col-md-10">
@Html.EditorFor(model => model.LaycanStartDate, new htmlAttributes = new @class = "form-control" )
@Html.ValidationMessageFor(model => model.LaycanStartDate, "", new @class = "text-danger" )
</div>
</div>

<script>
$(function ()
$.validator.methods.date = function (value, element)
);
</script>


Model



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy HH:mm")]
public DateTime LaycanStartDate get; set;


DateTime.cshtml



@model DateTime? 
@(Html.Kendo().DateTimePickerFor(m => m).HtmlAttributes(new style = "width: 100%; max-width: 280px", title = "datetimepicker"))









share|improve this question
















The view is working correctly and I can see the datetimepicker but when I click submit the datetime fields are null (if nullable) or 01/01/0001 00:00 if not nullable.



View



<div class="form-group">
@Html.LabelFor(model => model.LaycanStartDate, htmlAttributes: new @class = "control-label col-md-12" )
<div class="col-md-10">
@Html.EditorFor(model => model.LaycanStartDate, new htmlAttributes = new @class = "form-control" )
@Html.ValidationMessageFor(model => model.LaycanStartDate, "", new @class = "text-danger" )
</div>
</div>

<script>
$(function ()
$.validator.methods.date = function (value, element)
);
</script>


Model



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy HH:mm")]
public DateTime LaycanStartDate get; set;


DateTime.cshtml



@model DateTime? 
@(Html.Kendo().DateTimePickerFor(m => m).HtmlAttributes(new style = "width: 100%; max-width: 280px", title = "datetimepicker"))






c# asp.net-mvc datetimepicker kendo-asp.net-mvc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 10:07







Evan Barke

















asked Mar 28 at 9:00









Evan BarkeEvan Barke

461 silver badge8 bronze badges




461 silver badge8 bronze badges










  • 2





    This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

    – Panagiotis Kanavos
    Mar 28 at 9:05






  • 2





    A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

    – Panagiotis Kanavos
    Mar 28 at 9:06











  • Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

    – Evan Barke
    Mar 28 at 9:52











  • Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

    – Panagiotis Kanavos
    Mar 28 at 9:53






  • 1





    Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

    – Panagiotis Kanavos
    Mar 28 at 10:06












  • 2





    This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

    – Panagiotis Kanavos
    Mar 28 at 9:05






  • 2





    A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

    – Panagiotis Kanavos
    Mar 28 at 9:06











  • Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

    – Evan Barke
    Mar 28 at 9:52











  • Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

    – Panagiotis Kanavos
    Mar 28 at 9:53






  • 1





    Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

    – Panagiotis Kanavos
    Mar 28 at 10:06







2




2





This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

– Panagiotis Kanavos
Mar 28 at 9:05





This means that binding failed, not that the control sent NULL or a zero date. It could be that instead of an ISO8601 date, a localized string was posted with a format that doesn't match the server's.You can use Fiddler to check what's actually posted to the server

– Panagiotis Kanavos
Mar 28 at 9:05




2




2





A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

– Panagiotis Kanavos
Mar 28 at 9:06





A date's display format doesn't have to be the same as the format of the string posted to the server. You can configure the input box to use dd/MM/YYYY and still post YYYY-MM-dd to the server

– Panagiotis Kanavos
Mar 28 at 9:06













Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

– Evan Barke
Mar 28 at 9:52





Thanks. So Fiddler shows the values are coming through correctly but after binding in the ActionResult it's wrong. How can I change the format back to ISO on post?

– Evan Barke
Mar 28 at 9:52













Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

– Panagiotis Kanavos
Mar 28 at 9:53





Correcly means they are in ISO8601 form, ie 2019-03-28. Otherwise they are strings that need parsing which can fail

– Panagiotis Kanavos
Mar 28 at 9:53




1




1





Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

– Panagiotis Kanavos
Mar 28 at 10:06





Post that in the question please. This is the most important code. You can set the Format , culture and binding information there. Check this question for example.

– Panagiotis Kanavos
Mar 28 at 10:06












1 Answer
1






active

oldest

votes


















0
















So the only way I was eventually able to get around this was to remove the binding on the controller [Bind(....



Without that it allows the value through and the controller can deal with the format






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393583%2fkendo-datetimepickerfor-sending-null-or-01-01-0001-0000-to-controller%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    So the only way I was eventually able to get around this was to remove the binding on the controller [Bind(....



    Without that it allows the value through and the controller can deal with the format






    share|improve this answer





























      0
















      So the only way I was eventually able to get around this was to remove the binding on the controller [Bind(....



      Without that it allows the value through and the controller can deal with the format






      share|improve this answer



























        0














        0










        0









        So the only way I was eventually able to get around this was to remove the binding on the controller [Bind(....



        Without that it allows the value through and the controller can deal with the format






        share|improve this answer













        So the only way I was eventually able to get around this was to remove the binding on the controller [Bind(....



        Without that it allows the value through and the controller can deal with the format







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 5 at 4:42









        Evan BarkeEvan Barke

        461 silver badge8 bronze badges




        461 silver badge8 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393583%2fkendo-datetimepickerfor-sending-null-or-01-01-0001-0000-to-controller%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript