Search results

Getting Started

20 Oct 2021 / 2 minutes to read

This section briefly explains how to include a simple DateRangePicker control 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 controls.

Initialize DateRangePicker control to the Application

DateRangePicker control can be rendered by using the ejs-daterangepicker 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 DateRangePicker.

The following example shows a basic DateRangePicker control

Copied to clipboard
<ejs-daterangepicker id="daterangepicker"></ejs-daterangepicker>

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

Setting the start and end date

The start and end date in a range can be defined with the help of startDate and endDate property. The following example demonstrates to set the start and end date on initializing the DateRangePicker.

Copied to clipboard
<ejs-daterangepicker id="daterange" startdate="ViewBag.startDate" enddate="ViewBag.endDate"></ejs-daterangepicker>
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers
    public class DateRangePickerController : Controller
        public ActionResult DateRange()
            ViewBag.startDate = new DateTime(2017, 11, 09);
            ViewBag.endDate = new DateTime(2017, 11, 21);
            return View();

See Also