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
programmerist, here’s how i did this a little while back.
Create the editorfor template with the name DateTime.aspx:
then simply call it as such in your view:
cheers…