Set the readonly

24 Mar 20221 minute to read

The following example demonstrates how to set readonly in DatePicker control. You can achieve this by using readonly property.

<ejs-datepicker id="datepicker" readonly="true"  value="@ViewBag.value"  placeholder="Enter date"></ejs-datepicker>
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();
        }
    }
}