Syncfusion 19.4.0.55
I have a data grid with a modal edit form. That form has two DateTimePickers. When I use them to change (update) the time, I get the error "The input was not valid"
Entity:
public partial class Training
{
[Required(ErrorMessage = "Start date is required")]
[Display(Name = "Start Date")]
public DateTime StartDate { get; set; }
[Required(ErrorMessage = "End date is required")]
[Display(Name = "End Date")]
public DateTime EndDate { get; set; }
}
Razor:
<GridColumns>
<GridColumn Field=@nameof(Training.StartDate)
HeaderText="Start Date"
Format="MM/dd/yy HH:mm tt"
Width="120"
Type="ColumnType.Date">
</GridColumn>
<GridColumn Field=@nameof(Training.EndDate)
HeaderText="End Date"
Format="MM/dd/yy HH:mm tt"
Width="120"
Type="ColumnType.Date"
Visible="false">
</GridColumn>
</GridColumns>
<GridEditSettings AllowAdding="true"
AllowDeleting="true"
AllowEditing="true"
ShowDeleteConfirmDialog="true"
Mode="EditMode.Dialog"
Dialog="TrainingGridDialogParams">
<Template>
<DataAnnotationsValidator />
@{ var Training = (context as Training);}
<div class="form-row">
<div class="form-group col-md-6">
<label class="e-label-top">Start Date</label>
<SfDateTimePicker TValue="DateTime"
AllowEdit="true"
@bind-Value="@Training.StartDate"
Format="MM/dd/yy HH:mm tt">
</SfDateTimePicker>
</div>
<div class="form-group col-md-6">
<label class="e-label-top">End Date</label>
<SfDateTimePicker TValue="DateTime"
AllowEdit="true"
@bind-Value="@Training.EndDate"
Format="MM/dd/yy HH:mm tt">
</SfDateTimePicker>
</div>
</div>
</Template>
</GridEditSettings>
My apologies - I forgot the most important part:
<SfDataManager @ref="TrainingGridDataManager"
Url="@TrainingAPIUrl"
Adaptor="Adaptors.ODataV4Adaptor"
Headers=@HeaderData
>
</SfDataManager>
So, when the Save in the modal dialog is clicked, it is attempting to update the record via the Odata adaptor. That is when the error is thrown.
Your example throws a null value exception. See attached video.
Attached is a .zip file with a simple issue reproducing sample AND a video showing the replication of the problem.
Hi Scot,
We have fixed the reported DateTimeKind is set to Unspecified in
DateTimePicker’s value (time value) issue from our end in the 20.1.48
version. So, we suggest you upgrade to our latest version to resolve the
current issue.
Please find the release notes here : https://blazor.syncfusion.com/documentation/release-notes/20.1.48?type=all#bug-fixes-4
Regards,
Vignesh Natarajan