Miscellaneous in EJ 1 ASP.NET MVC DatePicker

8 Aug 2017 / 1 minute to read

Start Day

By default EJMVC DatePicker calendar starts with “Sunday” and ends with “Monday”. You can redefine this start day by using StartDay property.

Refer below code to start Wednesday as start day.

  • cshtml
  • @*sets start day as Wednesday in calendar*@
    
            @Html.EJ().DatePicker("datePicker").StartDay(3)

    Step Months

    The EJMVC DatePicker calendar allows you to quick navigate back and forth from one month to previous or next month by clicking the arrow button. By default it is navigate one by one month. You can also navigate by skipping months in odd or even or any count by using StepMonths property.

  • cshtml
  • @*skips the one months from current month(July to Sept to Nov)*@
    
            @Html.EJ().DatePicker("datePicker").StepMonths(2)

    Read Only

    You can make EJMVC DatePicker as read only by setting ReadOnly property as true. It allows only to read the value and it cannot be changed by interaction.

  • cshtml
  • @*sets DatePicker as read only*@
    
            @Html.EJ().DatePicker("datePicker").ReadOnly(true)

    Enable or Disable

    You can enable or disable the EJMVC DatePicker textbox by using Enabled property. In inline mode DatePicker calendar also gets enabled or disabled.

  • cshtml
  • @*disables the DatePicker textbox*@
    
            @Html.EJ().DatePicker("datePicker").Enabled(false)