Search results

Set the Readonly in ASP.NET MVC DatePicker control

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

razor
read.cs
@Html.EJS().DatePicker("datepicker").Readonly(true).Value(ViewBag.value).Placeholder("Choose a Date").Render()
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();
        }
    }
}