I am using the popup feature of kendoui grid to add/edit a record. The kendoui version that I am using is 2013.2.823. I find that whenever I click the "update" button to create/edit a record the create event is fired twice (see attached image). Any help would be much appreciated.
Soure Code:
Soure Code:
@(Html.Kendo().Grid<GroupModel>()
.Name(
"grid"
)
//.HtmlAttributes(new{style="display:block"})
.ToolBar(toolbar => toolbar.Create())
.EnableCustomBinding(
false
)
.PrefixUrlParameters(
false
)
.AutoBind(
true
)
//.Events(e => e.DataBound("grid_DataBound"))
.Editable(editable => editable.Mode(GridEditMode.PopUp).DisplayDeleteConfirmation(
true
).CreateAt(GridInsertRowPosition.Top))
//.Events(e=>e.Edit("grid_onEdit"))
.Pageable(p => p.Enabled(
true
).PageSizes(
new
[] { 10, 20, 30 }).Refresh(
true
).PreviousNext(
true
).ButtonCount(4).Info(
true
).Numeric(
true
))
.Navigatable(n => n.Enabled(
true
))
.Resizable(r => r.Columns(
true
))
.Scrollable(s => s.Height(
"auto"
))
.Selectable(s => s.Enabled(
false
).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
//.ClientDetailTemplateId("template")
//.RowAction(row => { })
.Sortable(sorting =>
{
sorting.SortMode(GridSortMode.SingleColumn);
sorting.Enabled(
true
);
})
.Filterable(filterable => filterable
.Extra(
true
)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith(
"Starts with"
)
.EndsWith(
"Ends with"
)
.Contains(
"Contains"
)
.IsEqualTo(
"Is equal to"
))
.ForNumber(num => num.Clear()
.IsEqualTo(
"Is equal to"
)
.IsGreaterThan(
"Is greater than"
)
.IsGreaterThanOrEqualTo(
"Is greater than or equal to"
)
.IsLessThan(
"Is less than"
)
.IsLessThanOrEqualTo(
"Is lesss than or equal to"
))
.ForDate(date => date.Clear()
.IsEqualTo(
"Is equal to"
)
.IsGreaterThan(
"Is after"
)
.IsGreaterThanOrEqualTo(
"Is after or equal to"
)
.IsLessThan(
"Is before"
)
.IsLessThanOrEqualTo(
"Is before or equal to"
))
))
.Columns(columns =>
{
//columns.Bound(p => p.PROV_GRP_ID).Visible(false).Width(100);
columns.Command(command => { command.Edit(); }).Width(75);
columns.Bound(p => p.PROV_GRP_KEY).Visible(
true
).Width(50);
columns.Bound(p => p.GroupName).Width(150);
columns.Bound(p => p.ContactFirstName).Width(120);
columns.Bound(p => p.ContactLastName).Width(120);
columns.Bound(p => p.ContactTitle).Width(100);
columns.Bound(p => p.PhoneNumber).Width(100);
columns.Bound(p => p.StreetAddress1).Width(150);
columns.Bound(p => p.StreetAddress2).Width(100);
columns.Bound(p => p.City).Width(150);
columns.Bound(p => p.State).Width(50);
columns.Bound(p => p.Zip).Width(50);
columns.Bound(p => p.Email).Width(150);
columns.Bound(p => p.IsDeleted).Width(50);
//columns.Bound(p => p.IsDeleted).ClientTemplate("#kendo.template($('#tmplActionMenu').html())#").HeaderTemplate(p => "Action").Width(100);
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(
true
)
.PageSize(20)
.Batch(
false
)
.AutoSync(
false
)
.Events(events => events.Error(
"grid_dataSource_OnError"
))
.Model(m =>
{
m.Id(p => p.PROV_GRP_KEY);
//m.Field(f => f.PROV_GRP_KEY).Editable(false);
//m.Field(f => f.IsDeleted).Editable(false);
})
.Read(read =>
{
read.Action(
"GetGroups"
,
"Roster"
);
read.Type(HttpVerbs.Post);
})
.Create(create =>
{
create.Action(
"CreateGroup"
,
"Roster"
);
create.Type(HttpVerbs.Post);
})
.Update(update =>
{
update.Action(
"UpdateGroup"
,
"Roster"
);
update.Type(HttpVerbs.Post);
})
.Destroy(destroy =>
{
destroy.Action(
"DeleteGroup"
,
"Roster"
);
destroy.Type(HttpVerbs.Post);
}))
)