– Date picker in mvc3 with razor view engine

I am using mvc3 and razor is my view engine how i get date picker with out using scripts in my

Best Solution

You can create a script in the directory scripts of your project.

Basic example:

$(document).ready(function () { $("#datepicker").datepicker({ });});

in your view:

@model YourProjectName.Models.User


<div class="editor-field">
  @Html.TextBoxFor(model => model.Dateadd, new { @Value = DateTime.Now, id = "datepicker" })
  @Html.ValidationMessageFor(model => model.Dateadd)