This question is locked. New answers and comments are not allowed.
I have the following grid inside a jqueryui dialog and I can insert the first record just fine but when i insert the 2nd one, when i return the view after adding the 2nd item I get a 500 error and i'm not sure what it's not finding since it found it the first time.
Grid Code:
Controller dataBinding functions:
am i missing something?
Grid Code:
<% Html.Telerik().Grid<SmartQuality.Presentation.Areas.Admin.Models.QuestionProperty>() .Name("gProperties") .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image)) .DataKeys(keys => keys.Add(o => o.QuestionPropertyId)) .Columns(columns => { columns.Bound(o => o.Text); columns.Bound(o => o.Value); columns.Bound(o => o.OrderBy); columns.Bound(o => o.IsDefault); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.BareImage); commands.Delete().ButtonType(GridButtonType.BareImage); }).Width(80); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("SelectPropertyToGrid", "Form") .Insert("InsertPropertyToGrid", "Form") .Update("UpdatePropertyToGrid", "Form") .Delete("DeletePropertyToGrid", "Form"); }) .Pageable() .Sortable() .Render(); %>Controller dataBinding functions:
[HttpPost] [GridAction] public ActionResult SelectPropertyToGrid() { return View(new GridModel(QuestionProperties)); } [HttpPost] [GridAction] public ActionResult InsertPropertyToGrid() { QuestionProperty qp = new QuestionProperty(); if (TryUpdateModel(qp)) { QuestionProperties qps = this.QuestionProperties; qps.Add(qp); this.QuestionProperties = qps; } return View(new GridModel(QuestionProperties)); } [HttpPost] [GridAction] public ActionResult UpdatePropertyToGrid(int id, string text, decimal value, int orderBy, bool isDefault) { QuestionProperty qp = this.QuestionProperties.Find(o => o.QuestionPropertyId == id); QuestionProperties qps = this.QuestionProperties; qp.Text = text; qp.Value = value; qp.OrderBy = orderBy; qp.IsDefault = isDefault; TryUpdateModel(qp); this.QuestionProperties = qps; return View(new GridModel(QuestionProperties)); } [HttpPost] [GridAction] public ActionResult DeletePropertyToGrid(int id) { QuestionProperty qp = this.QuestionProperties.Find(o => o.QuestionPropertyId == id); if (qp != null) { QuestionProperties qps = this.QuestionProperties; qps.Remove(qp); this.QuestionProperties = qps; } return View(new GridModel(QuestionProperties)); }am i missing something?