Required Validation on date does not work!

I have a datagrid that populates fine.. But when i click edit and my modal pops up.. All my validation checks work except the date columns... which is not very good as it allows me to post back to the server with datetimes like 0001-01-01... I don't want any datetime posted back if its not filled in.


                                            @**@
                                           
                                            
                                            @**@
                                           
                                           
                                           
                                           
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                           
                                       
                                           
                                           
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                           

5 Replies 1 reply marked as answer

DI Dingo October 15, 2020 03:04 PM UTC

 <SfGrid DataSource="@ReworkHistoryReplacement" AllowFiltering="true" Height="415" AllowSorting="true" AllowGrouping="true">
                                            @*<GridEvents OnActionBegin="BeginHistory" TValue="ReworkHistoryPartReplacementModel"></GridEvents>*@
                                            <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
                                            <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" ShowConfirmDialog="true" ShowDeleteConfirmDialog="true" Mode="EditMode.Dialog"></GridEditSettings>
                                            <GridPageSettings PageSizes="10"></GridPageSettings>
                                            <GridColumns>
                                                <GridColumn Field="Id" HeaderText="Id" IsPrimaryKey="true" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Visible="false" Width="200"></GridColumn>
                                                <GridColumn Field="Pattern" HeaderText="Pattern" IsPrimaryKey="true" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="200"></GridColumn>
                                                <GridColumn Field="Reason" HeaderText="Reason" Width="250" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center"></GridColumn>
                                                <GridColumn Field="ComponentIdentifier" HeaderText="  Component" Type="ColumnType.Date" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="120"></GridColumn>
                                                <GridColumn Field="RecipeName" HeaderText="Recipe" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="120"></GridColumn>
                                                <GridColumn Field="StepNumber" HeaderText="Step" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="120"></GridColumn>
                                                <br />
                                                <GridColumn Field="StartDate" HeaderText="Start Date" Format="d" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="120"></GridColumn>
                                                <GridColumn Field="EndDate" HeaderText="End Date" Format="d" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" Width="120"></GridColumn>
                                                <GridColumn Field="AddedBy" HeaderText="Added by" ValidationRules="@(new ValidationRules { Required = true })" TextAlign="TextAlign.Center" AllowEditing="false" Width="120"></GridColumn>
                                                <GridColumn Field="AddedOnUtc" HeaderText="AddedOnUtc" ValidationRules="@(new ValidationRules { Required = true })" Format="d" TextAlign="TextAlign.Center" AllowEditing="false" Width="120"></GridColumn>
                                            </GridColumns>
                                        </SfGrid>


JP Jeevakanth Palaniappan Syncfusion Team October 16, 2020 06:34 AM UTC

Hi Dingo, 

Greetings from Syncfusion support. 

We have validated your query by preparing a sample based on the provided code snippet in the latest Syncfusion NuGet version (18.3.0.41). But unfortunately, we are unable to reproduce the reported issue from our end. Please find the validated sample below for your reference. 


If you are still facing the issue kindly share us the below information. 

  1. Share the Syncfusion Nuget version details.
  2. Share us the issue reproducing sample or reproduce the issue in the provided sample.

The above-requested details will be helpful for us to validate the issue and provide you with a better solution as early as possible. 

Also we suggest you to ensure the issue in the latest version. 

Regards, 
Jeevakanth SP. 



DI Dingo October 16, 2020 08:43 AM UTC

Thanks for your reply, but unfortunately not working still. Seems only to be working on textboxes





DI Dingo October 16, 2020 11:00 AM UTC

I managed to figure out the issue, in my model class i had not made my properties nullable... And this is what caused the issue.. Would be nice if you could update your documentation to include that. Thanks.

Marked as answer

JP Jeevakanth Palaniappan Syncfusion Team October 19, 2020 08:03 AM UTC

Hi Dingo, 

We are happy to know that you have resolved the issue by your own. As per request we have created a documentation task to modify the suggested changes. It will be reflected once the documentation is refreshed. 

Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon