or
The ViewData item that has the key 'Proposal_Type_ID' is of type 'System.Int32'but must be of type 'IEnumerable<SelectListItem>'.<BR>public ActionResult GetResearchQuestions([DataSourceRequest]DataSourceRequest request){ User user = new User(); int user_id = user.GetUserIDByBNLAccount(User.Identity.Name); string user_facility_id = UserSession.LastViewedUserFacilityID; if (UserPermissions.VerifyUserFacility(user_id, user_facility_id)) { using (PASSEntities context = new PASSEntities()) { var vm = (from a in context.Proposal_Research_Questions join b in context.Proposal_Types on a.Proposal_Type_ID equals b.ID where b.User_Facility_ID == user_facility_id orderby a.Sort_Order select new ResearchQuestionViewModel() { ID = a.ID, Proposal_Type_ID = a.Proposal_Type_ID, Proposal_Type_Description = b.Description, Question = a.Question, Type = a.Type, Options = a.Options, Required = a.Required, Active = a.Active }).ToList(); var proposalTypes = (from a in context.Proposal_Types where a.User_Facility_ID == user_facility_id select a).ToList(); ViewData["ProposalTypes"] = proposalTypes.Select(m => new SelectListItem { Value = m.ID.ToString(), Text = m.Description }).ToList(); DataSourceResult result = vm.ToDataSourceResult(request); return Json(result, JsonRequestBehavior.AllowGet); } } else { return RedirectToAction("Index"); }}@{ ViewBag.Title = "Research Questions";}<h2>Proposal Research Questions</h2>@Html.Partial("LastViewedUserFacility")@{ Html.Kendo().Grid<PASSAdmin.ViewModels.UserFacilityAdmin.ResearchQuestionViewModel>() .Name("ResearchQuestions") .Columns(columns => { columns.Command(command => { command.Edit(); }).Width(50); columns.Bound(m => m.Question); columns.Bound(m => m.Proposal_Type_Description).Title("Proposal Type"); columns.Bound(m => m.Required).ClientTemplate("#= Required ? '<img src=\\'/Content/images/icons/check.png\\'' : '' #"); columns.Bound(m => m.Active).ClientTemplate("#= Active ? '<img src=\\'/Content/images/icons/check.png\\'' : '' #"); columns.Command(command => command.Custom("SortUp").Click("sortUp")); columns.Command(command => command.Custom("SortDown").Click("sortDown")); columns.Command(command => { command.Destroy(); }).Width(50); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UserFacilityAdmin/ResearchQuestion").Window(window => window.Width(500))) .Pageable() .Sortable() .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(m => m.ID)) .Create(create => create.Action("AddResearchQuestion", "UserFacilityAdmin")) .Read(read => read.Action("GetResearchQuestions", "UserFacilityAdmin")) .Update(update => update.Action("UpdateResearchQuestion", "UserFacilityAdmin")) .Destroy(destroy => destroy.Action("DeleteResearchQuestion", "UserFacilityAdmin")) ) .Render();}<script type="text/javascript">function sortUp(e) { e.preventDefault(); var id = this.dataItem($(e.currentTarget).closest("tr")).id; $.post('/UserFacilityAdmin/UpdateResearchQuestionSortOrder', { id: id, sortChange: -1 }, function (data) { $('#ResearchQuestions').data('kendoGrid').dataSource.read(); });}function sortDown(e) { e.preventDefault(); var id = this.dataItem($(e.currentTarget).closest("tr")).id; $.post('/UserFacilityAdmin/UpdateResearchQuestionSortOrder', { id: id, sortChange: 1 }, function (data) { $('#ResearchQuestions').data('kendoGrid').dataSource.read(); });}</script>@model PASSAdmin.ViewModels.UserFacilityAdmin.ResearchQuestionViewModel<div class="editor-label"> @Html.Label("Proposal Type")</div><div class="editor-field"> @Html.DropDownListFor(model => model.Proposal_Type_ID, (List<SelectListItem>) ViewData["ProposalTypes"], "(Select One)") @Html.ValidationMessageFor(model => model.Proposal_Type_ID)</div><div class="editor-label"> @Html.Label("Question")</div><div class="editor-field"> @Html.TextAreaFor(model => model.Question, new { style = "width:300px;height:50px;" }) @Html.ValidationMessageFor(model => model.Question)</div><div class="editor-label"> @Html.Label("Type")</div><div class="editor-field"> @Html.DropDownListFor(model => model.Type, new SelectList(Model.QuestionTypes, "Value", "Text"), "(Select One)") @Html.ValidationMessageFor(model => model.Type)</div><div class="editor-label"> @Html.Label("Options")</div><div class="editor-field"> @Html.TextAreaFor(model => model.Options, new { style = "width:300px;height:50px;" }) @Html.ValidationMessageFor(model => model.Options)</div><div class="editor-label"> @Html.Label("Required")</div><div class="editor-field"> @Html.CheckBoxFor(model => model.Required) @Html.ValidationMessageFor(model => model.Required)</div><div class="editor-label"> @Html.Label("Active")</div><div class="editor-field"> @Html.CheckBoxFor(model => model.Active) @Html.ValidationMessageFor(model => model.Active)</div>@{ if (@Model.IsClinicalAlert) { @(Html.Kendo().Button() .Name("redalertbutton") .ImageUrl(Url.Content("~/img/patient_alert_red.bmp")) .HtmlAttributes(new { type = "button" }) .Events(ev => ev.Click("onAlertClick"))) } else { @(Html.Kendo().Button() .Name("greenalertbutton") .ImageUrl(Url.Content("~/img/patient_alert_green.bmp")) .HtmlAttributes(new { type = "button" }) .Events(ev => ev.Click("onAlertClick"))) } }<script> $(document).ready(function () { if ($@Model.IsClinicalAlert) { alert(@Model.ClinicalAlert); var wdw = $("#alertWindow").data("kendoWindow"); wdw.open(); } }); function onAlertClick(e) { var wdw = $("#alertWindow").data("kendoWindow"); wdw.open(); }</script>@(Html.Kendo().Window() .Name("alertWindow") .Title("Clinical Alert") .Content(@<text><strong>@Model.ClinicalAlert</strong></text>) .Draggable() .Resizable() .Width(400) .Modal(true) .Visible(false) .Position(settings => settings.Top(150).Left(250)))$("#Html").kendoEditor({ imageBrowser: { schema: { model: { id: "EntFileId", fields: { name: "name", type: "type", size: "size", EntFileId: "EntFileId" } } }, transport: { read: "@Url.Action("Index", "EditorImageBrowser", new { area = "" })", destroy: { url: "@Url.Action("Delete", "EditorImageBrowser", new { area = "" })", type: "POST" }, create: { url: "@Url.Action("Create", "EditorImageBrowser", new { area = "" })", type: "POST" }, uploadUrl: "@Url.Action("Upload", "EditorImageBrowser", new { area = "" })" } }});return Json(new { name = "Test1.jpg", type = "f", size = 10000, EntFileId = "23ebf087-c946-4cb8-9f9c-f2584dd9aadc" });var data = $(".k-imagebrowser").data("kendoImageBrowser").dataSource.data();$.each(data, function (key, obj) { console.log(obj); //displays: i {_events: Object, name: "Test1.jpg", size: 10000, type: "f", EntFileId: "23ebf087-c946-4cb8-9f9c-f2584dd9aadc"…}});return Json(new { size = uploadedFileSize, name = file.Name, type = "f", EntFileId = file.FileId.ToString() }, "text/plain");i {_events: Object, type: "f", name: "402082_546613141879_2009325815_n.jpg", size: 30834, uid: "0bd12e68-8245-48fe-81e1-d123fc813415"…}@model IEnumerable<PASS.ViewModels.Proposals.IndexViewModel>@{ ViewBag.Title = "My Proposals";}<h2>My Proposals</h2><br /><p>@Html.ActionLink("Create New Proposal", "Create", null, new { @class="link-button" })</p>@(Html.Kendo().Grid(Model) .Name("Proposals") .Columns(columns => { columns.Bound(m => m.ID).Title("Proposal ID"); columns.Bound(m => m.Title).ClientTemplate("<a href='" + Url.Action("Update", "Proposals") + "/#= ID #'>" + "#= Title #" + "</a>"); columns.Bound(m => m.ProposalType).Title("Proposal Type"); columns.Bound(m => m.PI); columns.Bound(m => m.User_Facility_ID).Title("User Facility"); }) .Sortable() .ClientDetailTemplateId("template") .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(m => m.ID)) .Read(read => read.Action("Index", "Proposals")) ))<script id="template" type="text/kendo-tmpl">@(Html.Kendo().Grid<PASS.ViewModels.Proposals.TimeRequestsViewModel>() .Name("TimeRequests_#=ID#") .Columns(columns => { columns.Bound(m => m.Cycle); columns.Bound(m => m.Status_Description).Title("Status"); }) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("GetTimeRequests", "Proposals", new { proposalID = "#=ID#" })) ) .Sortable() .ToClientTemplate())</script>public ActionResult Index(){ int user_id = Convert.ToInt32(((Claim)((ClaimsIdentity)Thread.CurrentPrincipal.Identity).FindFirst(a => a.Type.Equals("UserID"))).Value); using (var context = new PASSEntities()) { var vm = (from a in context.Proposals join b in context.Proposal_Minions on a.ID equals b.Proposal_ID into j from c in j.DefaultIfEmpty() where (a.PI_User_ID == user_id || a.Creator_User_ID == user_id || (c.User_ID == user_id && c.Can_Read)) select new IndexViewModel() { ID = a.ID, Title = a.Title, ProposalType = a.Proposal_Types.Description, PI_User_ID = a.PI_User_ID, PI = (from d in context.Pools join e in context.Users on d.ID equals e.Pool_ID where e.ID == a.PI_User_ID select d.First_Name + " " + d.Last_Name).FirstOrDefault(), User_Facility_ID = a.User_Facility_ID }).Distinct().OrderByDescending(a => a.ID).ToList(); return View(vm); }}public ActionResult GetTimeRequests(int proposalID, [DataSourceRequest]DataSourceRequest request){ using (var context = new PASSEntities()) { var vm = (from a in context.Beamtime_Requests.ToList() where a.Proposal_ID == proposalID select new TimeRequestsViewModel() { ID = a.ID, Proposal_ID = a.Proposal_ID, Cycle = a.Cycle.Description + " " + a.Cycle.Year.ToString(), Cycle_Requested_ID = a.Cycle_Requested_ID, Status = a.Status, Status_Description = a.Beamtime_Request_Statuses.Description }).ToList(); DataSourceResult result = vm.ToDataSourceResult(request); return Json(result, JsonRequestBehavior.AllowGet); }}