Hi Below is my code :
The issue is when I try to add the sections marked as bold I get this exception The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'System.String'.
Note : I have a single controller that serves multiple views from multiple controller.
The issue is when I try to add the sections marked as bold I get this exception The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'System.String'.
Note : I have a single controller that serves multiple views from multiple controller.
@model IEnumerable<mobiCore.Models.ChecklistApprovalModel>@{ ViewBag.Title = "EditApprovals"; }<h2>Approvals</h2><script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script><style type="text/css">.detail-title-field{ width:98%; float:left; margin:0px 5px;}.detail-value-field{ width:98%; min-height:1.2em !important; background-color: #E3E4FA; margin:5px; padding:0 2px 0 2px; border:1px solid #728FCE; display:block; float:left;}</style><div id="generatetsDiv" style="width: 100%;"> @using (Html.BeginForm("index_approvals", "Checklist")){ @(Html.Kendo().Grid(Model) .Name("ChecklistGrid") .Columns(columns => { columns.Bound(p1 => p1.ApprovalID).Title("ApprovalID").Width(10); columns.Bound(p1 => p1.ManagerApproval).Title("IsApproved").Width(10); columns.Bound(p1 => p1.SubmitterID).Title("SubmitterID").Width(10); columns.Bound(p1 => p1.ApproverID).Title("ApproverID").Width(10); columns.ForeignKey(p1 => p1.ChecklistItemDateID, (System.Collections.IEnumerable)ViewData["checklistitemdatecoll"], "ChecklistItemDateID", "DateValue").Title("ChecklistDate").Width(50);}) .ToolBar(toolbar => toolbar.Save()) //.Editable(editable =>editable.Mode(GridEditMode.InCell)) .Selectable(select => select.Mode(GridSelectionMode.Single)) .Pageable() .Sortable() .Scrollable() .Filterable() .HtmlAttributes(new { style = "height:430px;" }) .DataSource(dataSource => dataSource .Ajax() .ServerOperation(false) .Batch(true) .Model(model1 => { model1.Id(p1 => p1.ApprovalID); //model1.Field(p1 => p1.ChecklistItemDateID).Editable(false); //model1.Field(p1 => p1.SubmitterID).Editable(false); //model1.Field(p1 => p1.ApproverID).Editable(false); }) .Read(read => read.Action("ChecklistApproval_Read", "Checklist")) .Update(update => update.Action("ChecklistApproval_Update", "Checklist")) ) )} </div><script type="text/javascript"> function error_handler(e) { if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function() { message += this + "\n"; }); } }); alert(message); } }</script>