Search results

Prevent the Popup Close in ASP.NET Core DatePicker control

To prevent the DatePicker popup from closing, use the preventDefault method from the PreventableEventArgs.

The following example demonstrates how to prevent the popup from closing.

<ejs-datepicker id="datepicker" close="onClose" placeholder="Choose a Date"></ejs-datepicker>

   document.addEventListener('DOMContentLoaded', function () {
     var datepickerObject = document.getElementById("datepicker").ej2_instances[0];;
    function onClose (args) {
        // prevent the popup close
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers
    public class HomeController: Controller
        public ActionResult sample()
            ViewBag.value = new DateTime(DateTime.Now.Year,DateTime.Now.Month,14);
            return View();