Hi Customer,
We could see you are using a HTML.DropDownListFor. To apply validation to the MVC element, you have to give the ValidationSummary within the form as discussed in the following article.
Normally, Grid will handle the validation for all the column if and only if they have been defined with Grid e-columns with the validation-rules. But, in your case, you have added some extra columns in the template form. So, we have handle them externally as discussed above. Refer to the following code example.
<script type="text/template" id="templateSearchDiagnosis">
<table>
<tr>
<td>
Diagnosis Name
</td>
<td>
<input id="Text" name="Text" value="{{: Text}}" disabled="disabled" class="e-field e-ejinputtext valid e-disable"
style="width: 116px; height: 28px" />
</td>
<td style="color:red">
Natural History of Illness
</td>
<td>
@Html.ValidationSummary()
@Html.DropDownListFor(model => model.NaturalId, ViewBag.lNatural as SelectList, "Select", new { @value = "DiagnosisTypeDesc", htmlAttributes = new { @class = "form-control" } , style = "width: 100%;height: 14px;display: block;font-size: 11px;line-height: 1.428571429;color: #555;vertical-align: middle;background-color: #fff;border: 1px solid #ccc;" })
</td>
</tr>
</table>
</script> |
Please make a note that the NaturalID must be set with required annotation. Refer to the following code example.
public class EditableOrder
{
[Required( ErrorMessage = "Selection is a MUST" )]
public string NaturalId
{
get;
set;
}
. . .
} |
Regards,
Seeni Sakthi Kumar S.