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

  • Home
  • SEARCH
  • 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 7756547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:51:07+00:00 2026-06-01T12:51:07+00:00

Problems with wiring up datepicker The code for partial view @model System.DateTime @Html.TextBox(, Model.ToString(dd/MM/yy),

  • 0

Problems with wiring up datepicker

The code for partial view

@model System.DateTime
@Html.TextBox("", Model.ToString("dd/MM/yy"), new { @class = "date" })

The code for the view

 @Html.TextBox("DateTime", (Model.AdvertStartDate.ToString()), new { @class = "date" })

Scripts

 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Code used for datepicker

<script type="text/javascript">
    $(document).ready(function () {
        $('.date').datepicker
        ({
            dateFormat: 'dd/mm/yy',
            showStatus: true,
            showWeeks: true,
            currentText: 'Now',
            autoSize: true,
            gotoCurrent: true,
            showAnim: 'blind',
            highlightWeek: true

        });
    });
</script>

Code for model

 [Required]
   public DateTime AdvertStartDate { get; set; }

The date is inserting into the textbox but is not updating in the database

Can you suggest anything that is missing?

  • 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-01T12:51:08+00:00Added an answer on June 1, 2026 at 12:51 pm

    I think the HTML <input> element rendered by TextBox("DateTime",...) doesn’t have the correct name (the name will be “DateTime”), so it doesn’t get bound correctly to your model property AdvertStartDate when the data are posted to the server.

    Your “partial view” looks like an EditorTemplate to me. In this case you should be able to just use this in your view:

    @Html.EditorFor(model => model.AdvertStartDate)
    

    Because AdvertStartDate is of type DateTime the EditorTemplate including the DatePicker should be used to render the input element.

    If the EditorTemplate file has another name than DateTime.cshtml – like AnotherTemplateName.cshtml – you can specify the template explicitly:

    @Html.EditorFor(model => model.AdvertStartDate, "AnotherTemplateName")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problems are: GUI libraries like to use ToString as a default representation for
I'm having problems with some code to create a CDialog based window. The code
Unable to compile class for JSP Generated servlet error: @DefaultMessage(Last Updated: {0,date,medium} {0,time, HH:mm:ss
Having problems with a small awk script, Im trying to choose the newest of
Having problems iterating. Problem has to do with const correctness, I think. I assume
Having problems with the combining of two statements in a controller. Both statements work
When experiencing networking problems on client machines, I'd like to be able to run
I am having problems getting JBoss to inject an environment variable value into a
I have started having problems with my VPS in the way that it would
I'm having problems compiling the following program. I'm using gcc -framework Foundation inherit8.1m and

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.