I am using ASP.NET Core Datagrid with a dialog template to add/edit. For some reason, the first field in error does not display the error message.
Here is a sequence of pictures to show the problem.
WarehouseName, and State are required fields. If both are left blank, WarehouseName does not show the error.
WarehouseName, ZipCode, and State are required fields. If only ZipCode is left blank, it does not show the error when pressing the save button.
|
_DialogAddPartial partial
<div class="form-row">
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
@Html.TextBox("OrderID")
<span class="e-float-line"></span>
@Html.Label("OrderID", "Order ID", new { @class = "e-float-text e-label-top" })
</div>
</div>
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
<ejs-textbox id="CustomerID" placeholder="CustomerID" floatLabelType="Auto"></ejs-textbox>
</div>
</div>
</div>
Index.cshtml
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" validationRules="@(new { required= true })" textAlign="Right" width="100"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" type="string" validationRules="@(new { required= true })" width="120"></e-grid-column>
|
|
DialogAddPartial partial
<div class="form-group col-md-6">
<div class="e-float-input e-control-wrapper">
@Html.TextBox("QuestionTypeId")
<span class="e-float-line"></span>
// QuestionTypeId field is not present in the Grid column model
@Html.Label("QuestionTypeId", "Question Type Id", new { @class = "e-float-text e-label-top" })
</div>
</div>
Index.cshtml
function ActionComplete(args) {
if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {
// add the validation rule to QuestionTypeId field
args.form.ej2_instances[0].addRules('QuestionTypeId', { required: true }); }
}
|