Search results

Getting Started

This section briefly explains how to include a simple DatePicker component in your ASP.NET Core application. You can refer to ASP.NET Core Getting Started documentation page for system requirements, and configure common specifications.

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your ASP.NET Core application to use our components.

Initialize DatePicker component to the Application

DatePicker component can be rendered by using the ejs-datepicker tag helper in ASP.NET Core application. Add the below simple code to your index.cshtml page which is available within the Views/Home folder, to initialize the DatePicker.

The following example shows a basic DatePicker component.

<ejs-datepicker id="datepicker"></ejs-datepicker>

Running the above code will display the basic DatePicker on the browser.

Setting the value, and min and max dates

To restrict the selection of date within a specified range, use the min and max properties.

The below example demonstrates the DatePicker to select a date within a range from 5 to 27 in a current month.

<ejs-datepicker id="datepicker" value="@ViewBag.value" min="@ViewBag.minDate" max="@ViewBag.maxDate" ></ejs-datepicker>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling MVC for empty projects, visit

namespace EJ2CoreSampleBrowser.Controllers
    public partial class HomeController : Controller
        // GET: /<controller>/
        public IActionResult DateRange()
            ViewBag.minDate= new DateTime(DateTime.Now.Year,DateTime.Now.Month,05);
            ViewBag.maxDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 27);
            return View();