Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:59:26+00:00 2026-06-09T05:59:26+00:00

I use datetime picker for ASP.NET MVC with razor, when submitted form got validation

  • 0

I use datetime picker for ASP.NET MVC with razor, when submitted form got validation error message, it would not keep my entered values nor the picker not work anymore. Is it possible to reuse picker control after validation error happened?.

My view with picker:

<div class="editor-label">
    @Html.LabelFor(model => model.StartDateTime)
</div>
<div class="editor-field">
    @Html.TextBox("Start", null, new { @class = "date" })
    @Html.ValidationMessageFor(model => model.StartDateTime)
</div>

jquery picker control:

<script src="/Scripts/mobiscroll-2.0.1.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
    var now = new Date();

    $('#Start').scroller({
        preset: 'datetime',
        minDate: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
        theme: 'ios',
        display: 'modal',
        mode: 'scroller'
    });</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:59:27+00:00Added an answer on June 9, 2026 at 5:59 am

    you could do something like this, (please excuse syntax error if any)

    public ActionResult MyView(MyModel model)
    {
       if(!ModelState.IsValid())
       { 
         return View("BackToForm", model)
       }
    }
    

    this way you could preserve the values in your input fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following date picker in a mobile asp.net mvc razor website
I'm working on an ASP.NET MVC 3 application and having some issues. I've got
Using ASP.Net & C# I want to use a datetimepicker in my web page,
i am trying to use a date picker, but i am not sure how
I am trying to use the DateTime picker custom gridview column type from this
I use jquery.pttimeselect.js to create datetime picker. How to change its background? The css
I have a problem with search form. I use date-time picker for user to
I want to use datetime picker in 4 text box. JQuery datepicker for 4
How to validate Datetime property in my MVC2 Validation. I have telerik datetime picker
I'd like to use the new HTML5 form-input-types like datetime and additionally offer an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.