Example of Default Functionalities in ASP.NET MVC DateRangePicker Control
The following sample demonstrates the default functionalities of the DateRangePicker. Today's date is always highlighted in the popup calendar and it get focused if there's no selected date. Select a date range from the popup calendar and the selected date range will be displayed in the DateRangePicker element.
@Html.UiDateRangePicker("daterangepicker_start", "daterangepicker_end", new UiDateRangePickerOptions { Id = "daterangepicker", Placeholder = "Choose a Range" })
<style>
#wrapper { max-width: 246px; margin: 30px auto; padding-top: 50px; }
</style>
<div class="control-section">
<div id="wrapper">
@Html.UiDateRangePicker("daterangepicker_start", "daterangepicker_end", new UiDateRangePickerOptions { Id = "daterangepicker", Placeholder = "Choose a Range" })
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class DateRangePickerController : Controller
{
// The page is Views/DateRangePicker/DefaultFunctionalities.cshtml; it draws what ViewData holds.
public ActionResult DefaultFunctionalities()
{
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
DateRangePicker is an interactive component that allows the user to select a range from the calendar, or to set a range value.