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 8214797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:34:36+00:00 2026-06-07T11:34:36+00:00

i have 2 important question. 1) DateTimePicker is working good on <input type=text name=date

  • 0

i have 2 important question.

1) DateTimePicker is working good on <input type="text" name="date" id="date"/> but no css effect and color.
2) <%Html.EditorFor(m => m.StartDateTime, new { @class = "datepicker" })%> is not working. No show datetimepicker.

How to make jquery datetimepicker. My Referenced article is : http://geekswithblogs.net/michelotti/archive/2010/02/05/mvc-2-editor-template-with-datetime.aspx


<link rel="stylesheet" href="../../Styles/jquery.ui.all.css"  type="text/css" />
<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-1.7.2.min.js") %>"></script>
<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-ui.js") %>"></script>
<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery.ui.datepicker.js") %>"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('.datepicker').datepicker({});
        $('#date').datepicker({});

    });
</script>





<table>
<tr><td><input type="text" name="date" id="date" /></td></tr>
<tr><td><%:Html.LabelFor(m=>m.StartDateTime) %></td><td><%:Html.EditorFor(m => m.StartDateTime, new { @class = "datepicker" })%></td></tr>
</table

  • 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-07T11:34:38+00:00Added an answer on June 7, 2026 at 11:34 am

    programmerist, here’s how i did this a little while back.

    Create the editorfor template with the name DateTime.aspx:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime?>" %>
    
    <%string name = ViewData.TemplateInfo.HtmlFieldPrefix;%>
    <%string id = name.Replace(".", "_");%>
    
    <div class="editor-label">
        <%= Html.LabelFor(model => model) %>
    </div>
    <div class="editor-field">
        <%= Html.TextBox("", (Model.HasValue ? Model.Value.ToString("dd-MM-yyyy") : string.Empty), new { @class = "date" }) %>
        <%= Html.ValidationMessageFor(model => model)%>
    </div>      
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#<%=id%>").datepicker({
                dateFormat: 'dd-mm-yy',
                changeMonth: true,
                changeYear: true,
                showOn: 'button', 
                buttonImage: '<%=Url.Content("~/Content/images/calendar.gif") %>'
            });
        });
    </script>
    

    then simply call it as such in your view:

    <%= Html.EditorFor(m => m.StartDate) %>
    

    cheers…

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

Sidebar

Related Questions

I have following 2 activities(plus many more not important for this question): <activity android:name=.activities.HomeActivity
Edit (updated question) I have a simple C program: // it is not important
I run a site where it is important to have good and simple URLs
I have a lein project (using cascalog--but that's not particularly important). I'm trying to
We have a very important application, but so far no source code. The application
i have a very important question that seem to be difficult for me ..
I've a question more about 'Good Programming Practices'. I have just started a really
Not a very important question, but here we go.. How do you avoid using
This might be the least important Scala question ever, but it's bothering me. How
Hi everyone I have really important question please help me. I'm trying to handle

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.