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.
<ejs-datepicker id="datepicker" focus="onFocus" placeholder="Choose a Date"></ejs-datepicker>
<script>
function onFocus (args) {
var datepickerObject = document.getElementById("datepicker").ej2_instances[0];
datepickerObject.show();
}
</script>
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.