Reputation: 53
<ejs-datepicker ejs-for="ToDate" StrictMode=true
style="background-color:#fff;"
min="01/01/2023" max="12/12/2023"
format="MM/dd/yyyy" id="ToDate"></ejs-datepicker>
The above Syncfusion datepicker in .NET Core is throwing an error.
Can you help?
Upvotes: -1
Views: 130
Reputation: 86
You need to utilize the min and max properties with actual date values rather than string formats. You can follow the Syncfusion DatePicker documentation to ensure smooth operation of the DatePicker component.
@{
ViewData["Title"] = "Home Page";
var minDate = new DateTime(2023, 1, 1);
var maxDate = new DateTime(2023, 12, 12);
}
@model SyncfusionCoreWebApplication.Controllers.DatePicker
<div style="margin:150px auto;width:300px">
<form method="post">
<ejs-datepicker id="datepickerFor"
ejs-for="@Model.value"
strictMode="true"
min="@minDate"
max="@maxDate"
format="MM/dd/yyyy"></ejs-datepicker>
<div id="errorMessage">
<span asp-validation-for="value"></span>
</div>
<div id="submitbutton">
<ejs-button id="submitButton" content="Submit"></ejs-button>
</div>
</form>
</div>
Ensure to refer to the following documentation for proper usage of the min and max properties, as well as rendering DatePickerFor:
Additionally, using the style attribute directly on the DatePicker isn't the correct method for customizing its appearance. For UI customization, refer to the following documentation:
Upvotes: 0