Showing posts with label jQuery DatePicker. Show all posts
Showing posts with label jQuery DatePicker. Show all posts

Display multiple months in jQuery DatePicker in MVC3 Razor




  1. In this article we will see how to display multiple months in jQuery DatePicker.
  2. jQuery DatePicker in default behaviour shows dates for single month.
  3. We can make DatePicker to show dates for multiple months by setting numberOfMonths property.
  4. The property accepts integer value.


Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created our ViewModel. We have a DOB property of type DateTime. The View will bind to this ViewModel and will generate control for this property which is our DatePicker.

View :


@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            numberOfMonths: 3,
            showButtonPanel: true
        });
    });
</script>

In the View the ViewModel is binded and the boolean property to show button panel is set to true.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

We need to include above jQuery script reference to make DatePicker work.

Demo :


Click inside textbox to open DatePicker.


Thus by setting the numberOfMonths property, we can display multiple months. We have supplied 3 to this property in the above example. On clicking the textbox we will see dates of 3 months.

Display week of year in jQuery DatePicker in MVC3 Razor




  1. In this article we will see how to display week of year in jQuery DatePicker.
  2. In order to achieve this we need to set boolean property showWeek to true.
  3. We can also set the day of week to display the dates.


Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created our ViewModel. We have a DOB property of type DateTime. The View will bind to this ViewModel and will generate control for this property which is our DatePicker.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            showWeek: true,
            firstDay: 1
        });
    });
</script>

In the View the ViewModel is binded and the boolean property to show button panel is set to true.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

We need to include above jQuery script reference to make DatePicker work.

Demo :





Thus by setting the boolean property showWeek to true, we can also display the week number.

Display dates of other months in jQuery DatePicker in MVC3 Razor



  1. In this article we will see how to show dates of other months in current month display.
  2. In default display, jQuery DatePicker shows only dates of current month.
  3. Not only you could see the dates of other month but also you can select the dates.
  4. In order to show dates of other month, we need to set boolean property showOtherMonth to true.
  5. We need to set boolean property selectOtherMonth to true to select other dates.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created our ViewModel. We have a DOB property of type DateTime. The View will bind to this ViewModel and will generate control for this property which is our DatePicker.

View :


@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            showOtherMonths: true,
            selectOtherMonths: true
        });
    });
</script>

In the View the ViewModel is binded and the boolean property to show button panel is set to true.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Demo :

click inside textbox to open DatePicker.



Thus by this way we can show dates of other months and even can select them.

Display button bar in jQuery DatePicker in MVC3 Razor




  1. In this article we will see how to display button display bar in jQuery DatePicker.
  2. We need to set one boolean property showButtonPanel to true.
  3. The button panel has two buttons by default. 
  4. One is Today button to select today's date in the calendar and other is Done button to close the DatePicker.
  5. Button are enabled by default when the bar is displayed, but can be turned off with additional options.
  6. Button text is customizable.


Following are the steps :

We will create our ViewModel first.

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created our ViewModel. We have a DOB property of type DateTime. The View will bind to this ViewModel and will generate control for this property which is our DatePicker.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            showButtonPanel: true
        });
    });
</script>

In the View the ViewModel is binded and the boolean property to show button panel is set to true.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

We need to include reference of above script files to make DatePicker work.

Demo :


Click inside textbox to display DatePicker.


Thus setting the boolean property to true i.e. showButtonPanel displays the button panel bar. The buttons are enable by default. We can customize the button text and can include more buttons.

jQuery DatePicker with month and year menus in MVC3 Razor



  1. In this article we will see how to display month and year dropdown menus in jQuery DatePicker.
  2. Using this menus, we can select any month and year from dropdown instead of moving to required month or year by clicking next or previous images.
  3. We will use this jQuery DatePicker with MVC3 Razor application.
  4. We can show month and year dropdown on datepicker by setting boolean parameters changeMonth and changeYear to true.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

View :


@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>

We have used EditorFor helper to render control for our ViewModel property. In the script section we have set the boolean properties changeMonth and changeYear to true.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Demo :

Click inside textbox to open datepicker.


Thus by setting the changeYear and changeMonth parameters, we can display the dropdowns to select year and month respectively.

jQuery DatePicker inline mode in MVC3 Razor



  1. In this article we will see how to render jQuery DatePicker in inline mode.
  2. Generally datepicker opens up on click of button or on clicking inside textbox.
  3. The inline display the datepicker embedded in the page instead of in an overlay. 
  4. We need to call  .datepicker() on a div instead of an input to achieve inline datepicker.
  5. We will see how we can render Inline DatePicker in MVC3 Razor application.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        [UIHint("DOB")]
        public DateTime DOB { get; set; }
    }
}

The above is our ViewModel. The ViewModel contains a property which is of type DateTime. As you can see we have define DataAnnotation property UIHint which indicates to call EditorTemplate with name DOB to render control for this property. In EditorTemplate we are rendering a div element.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>

@using (Html.BeginForm("DatePicker", "DatePicker"))
{
@Html.EditorFor(Model => Model.DOB)
<input type="submit" value="Submit" />
}

<script type="text/javascript">

    $(document).ready(function () {

        $('#DOB').datepicker();
    });
</script>

EditorTemplate :


<div id="DOB"></div>

Layout :


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Include the above jquery files in your layout referred by View.

Demo :





Using the Div instead of textbox, we could render datepicker in inline mode i.e. embedded on page. 

Populate alternate Field using jQuery DatePicker in MVC3 Razor




  1. In this article we will see how to show the date selected in the datepicker textbox in some other container.
  2. Often we have requirement where we want to show same date in different formats. 
  3. We cannot show same date in different formats in same container (like textbox).
  4. In order to achieve this we can create another textbox and can show same date selected in other format.
  5. We will see this feature integrated with MVC3 Razor application.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created a ViewModel. We will bind this ViewModel to our view. The poperty defined in the ViewModel will be rendered as control. We will use this property to use DatePicker.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>
@Html.EditorFor(Model => Model.DOB)

<input type="text" id="alternate" />

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            altField: "#alternate",
            altFormat: "DD, d MM, yy"
        });
    });
</script>

In the View, we have binded the ViewModel. We are using EditorFor to render control for our DOB property. We have also created one textbox. On selecting the date from datepicker, the alternate textbox will show the date in different format.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Demo :

Click inside first textbox to open datepicker.


When you select date after opening the datepicker. The date gets displayed in the textbox also date gets displayed in alternate textbox with spcified format.

By this way we can display the selected field in alternate control with another format for user convinience.

Restrict Date Range in jQuery DatePicker in MVC3 Razor



  1. In this article we will see how to restrict date range in jQuery DatePicker.
  2. We often have a requirement where we have a minimum date, before which we do not want to select date, or in other way we have a maximum date.
  3. In such scenarios we want to restrict date range in jQuery DatePicker.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created a ViewModel which contains DOB property. We will bind this ViewModel to view to render control for this property. The property is of type DateTime.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>
@Html.EditorFor(Model => Model.DOB)

<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({ minDate: -20, maxDate: "+1M +10D" });
    });
</script>

In the above view we have binded the DOB property. We are rendering datepicker on clicking the textbox. We have restricted the date range by using minDate and maxDate property. According to above properties we cannot select date futher to 20 days before today and in the same way 1 month and 10 days after today.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

We have to include above references of jQuery script files for using DatePicker.

Demo :


Click inside textbox to open DatePicker.


By following steps we can restrict date range in jQuery DatePicker.

Date Formats supported by jQuery DatePicker



  1. In this article we will see different formats supported by jQuery DatePicker.
  2. In the earlier examples we have seen how to render the datepicker on click of textbox and on click of button.
  3. jQuery DatePicker supports multiple dateformats. We will see how to change or apply different date formats.
  4. We are going to use this datepicker in MVC3 Razor project.

Following are the steps :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created a ViewModel and defined DOB property which is of type DateTime. We will bind this property to the view to render control for this property.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}


@Html.EditorFor(Model => Model.DOB)

<p>Format options:<br />
 <select id="format">
  <option value="mm/dd/yy">Default - mm/dd/yy</option>
  <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
  <option value="d M, y">Short - d M, y</option>
  <option value="d MM, y">Medium - d MM, y</option>
  <option value="DD, d MM, yy">Full - DD, d MM, yy</option>
  <option value="'day' d 'of' MM 'in the year' yy">With text - 'day' d 'of' MM 'in the year' yy</option>
 </select>
</p>
<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker();
        $("#format").change(function () {
            $("#DOB").datepicker("option", "dateFormat", $(this).val());
        });
    });
</script>

In the View, we have created a dropdown. We have populated dropdown with different date formats supported by jQuery DatePicker. On select of dropdown, we are applying the selected date format to the DatePicker.


Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>


Demo :


Select a date on clicking textbox. Then change the formats from dropdown to see date in different formats.


On selecting date formats from the dropdown, we are applying the selected format to the datepicker.

By this way we can apply date formats to datepicker.

jquery DatePicker on button Click in MVC3 Razor




  1. In this article we will see how to open datepicker on button or image click.
  2. In the other article we saw how to open datepicker on clicking inside textbox.
  3. The default behavior of jQuery UI Datepicker control is to show Datepicker on click to the element to which it is bind. But sometimes it is required to open the datepicker control on click of button.
We need to set following properties :
  • showOn: This is compulsory.
  • buttonText: This is optional. If set then text is displayed on the button on mouseover.
  • buttonImageOnly: This is optional but set to true to place an image after the field to use as the image without it appearing on a button.
  • buttonImage: This is also compulsory. The URL for the popup button image.


ViewModel :


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

View :


@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>
@Html.EditorFor(Model => Model.DOB)
<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker({
            showOn: "button",
            buttonText: "DatePicker",
            buttonImage: "../../Content/themes/base/images/calendar.gif",
            buttonImageOnly: true
        });
    });
</script>

In the view under script section, we have set the above properties, which renders a image next to textbox and on click of which datepicker opens.

Layout :



<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Demo :




The showOn : "button" renders a image next to the textbox. On click of this image, datepicker opens. The buttonImage property accepts a image url which is shown as icon.


By following steps we can open DatePicker on click of image or button instead of textbox.

jQuery DatePicker and customization in MVC3 Razor



  1. In this article we will see how to use DatePicker in MVC3 Razor. 
  2. We do not have html helper to render DatePicker in MVC3.
  3. We are going to use jQuery DatePicker to fulfill our requirement.

Following are the steps to render simple DatePicker :

ViewModel :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace jQueryDatePicker.Models
{
    public class Register
    {
        public DateTime DOB { get; set; }
    }
}

We have created a ViewModel. We have defined a property named DOB of type DateTime. We are going to bind our view with this ViewModel.

View :



@model jQueryDatePicker.Models.Register
@{
    Layout = "../Shared/_Layout.cshtml";
}

<!DOCTYPE html>
@Html.EditorFor(Model => Model.DOB)
<script type="text/javascript">

    $(document).ready(function () {
        $("#DOB").datepicker();
    });
</script>

Our View looks as above. We have include the reference of our ViewModel. We have used EditorFor helper to render control for address property. We have also added the script section. In the script section we have used id of control to select the control and used datepicker() method to render datepicker.

Demo :


Click inside TextBox


We have include following jQuery reference in the layout file to datepicker to work.

Layout :




<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.core.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
</head>

<body>
    @RenderBody()
</body>
</html>

Include above references in your layout and refer this layout in your view.


Following above steps we can use jQuery DatePicker for our MVC3 application.



More on jQuery DatePicker :