Search results

Open the DatePicker popup upon focusing input of DatePicker in ASP.NET Core DatePicker control

28 Jan 2022 / 1 minute to read

You can open the DatePicker popup on input focus by calling the show method in the input focus event.

The following example demonstrates how to open the DatePicker popup when the input is focused.

Copied to clipboard
<ejs-datepicker id="datepicker" focus="onFocus" placeholder="Choose a Date"></ejs-datepicker>

    function onFocus (args) {
        var datepickerObject = document.getElementById("datepicker").ej2_instances[0];;
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 HomeController: Controller
        public ActionResult sample()
            ViewBag.value = new DateTime(DateTime.Now.Year,DateTime.Now.Month,14);
            return View();

Output be like the below.