为什么不在编辑字段的编辑器模板上向我显示网格验证?我不明白为什么不阅读数据注释。抱歉英语不好...
起初我像这样创建了剑道网格:
<div id="grid">
@(Html.Kendo().Grid<CardView>()
.Name("Grid")
.Columns(x =>
{
x.Bound(c => c.CardID).Title("Card Nm.");
x.Bound(c => c.ExpirationDate).Format("{0:dd/MM/yyyy}");//.EditorTemplateName("KendoDatePicker");
x.Command(cmd =>
{
cmd.Edit();
}).Title("Edit");
})
.BindTo(Model)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(x => x.CardID);
})
.ServerOperation(true)
.Read(read => read.Action("Index", "Home"))
.Events(events => events.Error("error_handler"))
.Update(update => update.Action("Update", "Home"))
.Editable(editable =>editable.Mode(GridEditMode.InLine)))
</div>
Run Code Online (Sandbox Code Playgroud)
这是在数据源事件错误中使用的 javascript:
<script>
function error_handler(e, status) {//Klaidu isvedimas
if (e.errors) {
var message = "Error:\n";
var grid = $('#GrdKendo').data('kendoGrid');
var gridElement = grid.editable.element;
var validationMessageTemplate = kendo.template(
"<div id='#=field#_validationMessage' " + …Run Code Online (Sandbox Code Playgroud)