I have Kendo Grid and used a window for editing.
i want closing window with condition.
if (person.FName =="Jone")
close window
else
msgbox "You can not Closing this window!"
how to do?
my controller:
and Index Form:
and PersonDetail:
please hel me.
i want closing window with condition.
if (person.FName =="Jone")
close window
else
msgbox "You can not Closing this window!"
how to do?
my controller:
public ActionResult UpdatePerson([DataSourceRequest] DataSourceRequest dsRequest, PersonViewModel person) { if (person != null && ModelState.IsValid) { var db = new PersonDBEntities();
//... Condition
// if (person.FName =="Jone")
//......
//........
var toUpdate = db.tblPerson.FirstOrDefault(p => p.PersonID == person.PersonID); if (toUpdate != null) { toUpdate.FName = person.FName; toUpdate.LName = person.LName; db.SaveChanges(); } } return Json(ModelState.ToDataSourceResult()); }@{ ViewBag.Title = "Person";}@(Html.Kendo().Grid<KendoMVCWrappers.Models.PersonViewModel>().Name("persons") .DataSource(dataSource => dataSource .Ajax() .Model(model=>model.Id(m=>m.PersonID)) .Read(read => read.Action("GetPersons", "Person")) .Create(up => up.Action("CreatePerson", "Person")) .Update(up => up.Action("UpdatePerson", "Person")) .Destroy(del => del.Action("DeletePerson", "Person")) ) .ToolBar(cmd => cmd.Create().Text("Add")) .Columns(columns => { columns.Bound(c => c.FName).Width(100); columns.Bound(c => c.LName).Width(200); columns.Command(cmd => { cmd.Edit().UpdateText("Save").CancelText("Cancel").Text("Detail"); cmd.Destroy().Text("Del"); }); }) .Pageable() .Selectable(sel => sel.Mode(GridSelectionMode.Single)) .Filterable() .Sortable() .Editable(ed=>ed.Mode(GridEditMode.PopUp).TemplateName("PersonDetail").Window(w => w.Title("Detail"))) )and PersonDetail:
@model KendoMVCWrappers.Models.PersonViewModel <div class="k-content"> <div id="detail"> <ul> <li> <label for="fname" class="required">First Name</label> <input type="text" id="fname" name="fname" class="k-textbox" data-bind="value: FName" /> </li> <li> <label for="lname">Last Name</label> <input id="lname" name="lname" type="number" class="k-textbox" data-bind="value: LName"/> </li> <li style="height:250px"> </li> </ul> </div></div>please hel me.