Date in other months in EJ 1 ASP.NET MVC DateTimePicker
5 Jan 2018 / 1 minute to read
DateTimePicker calendar can display the dates in other months at the start or end of the current month. To enable or disable the display of other month dates in the current month, you can use the property called ShowOtherMonths. By setting this property value as “true” you can display the dates in other months at the start or end of the current month. By default the value of this property is “true”.
Consider you are going to calculate the monthly report of your company’s employee attendance. To avoid the mistake of selecting other month dates while calculating current month report, you can disable showing other month dates in the current month. You can achieve this requirement by setting ShowOtherMonths value as “false”.
Add the following code in your CSHTML page to render DateTimePicker widget.
@*Add the following code example to the corresponding CSHTML page to render DateTimePicker widget with customized other months*@ @Html.EJ().DateTimePicker("DateTime").ShowOtherMonths(false).Width("175px")
The following screenshot displays the output for the above code.