Search results

Set the Readonly in ASP.NET Core DatePicker control

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

tagHelper
read.cs
<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();
        }
    }
}