Recently i was working on a MVC 2 Project and needed an date picker. I used the Jquery atepicker widget which gave me great control over picking up dates on the TextBox.
<link rel="stylesheet" href="<%= Url.Content("http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css") %>" /> <script src="<%= Url.Content("http://code.jquery.com/jquery-1.9.1.js") %>"></script> <script src="<%= Url.Content("http://code.jquery.com/ui/1.10.3/jquery-ui.js") %>"></script> <script> $(function () { $("#DeliveryDate").datepicker({ dateFormat: "dd/MM/yy" }).val() }); </script> <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary(true) %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%: Html.LabelFor(model => model.DeliveryDate) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.DeliveryDate) %> <%: Html.ValidationMessageFor(model => model.DeliveryDate) %> </div> <% } %>
No comments:
Write comments