or
<script> function contractorChanged() { $.ajax({ type: "POST", url: '@Url.Action("GetContactPersons", "Permission")', data: { id: $("#ContractorId").val() }, cache: false, success: function (data) { $("#ContractorPersonId").data("kendoDropDownList").setDataSource(data); $("#ContractorPersonId").data("kendoDropDownList").value('@Model.ContractorPersonId'); } }); } </script> @(Html.Kendo().DropDownListFor(model => model.ContractorId) .HtmlAttributes(new { style = "width:100%; margin-bottom: 8px;" }) .OptionLabel("Välj företag") .DataTextField("Name") .DataValueField("Id") .Events(e => e.DataBound("contractorChanged")) .DataSource(source => { source.Read(read => { read.Action("GetConstructors", "Permission"); }); })) @(Html.Kendo().DropDownListFor(model => model.ContractorPersonId) .HtmlAttributes(new { style = "width:100%" }) .OptionLabel("Välj kontaktperson") .DataTextField("FullName") .DataValueField("Id") .Enable(false) .AutoBind(false) .CascadeFrom("ContractorId") )<div class="draggable"> drag me</div><div id="test-area"> <h2> Test area </h2> <h2> Test area </h2> <h2> Test area </h2> <h2> Test area </h2> <h2> Test area </h2> <h2> Test area </h2> <h2> Test area </h2></div><script> $(document).ready(function () { $("#test-area").kendoDropTargetArea({ dragenter: DragAndDrop.dropTargetOnDragEnter, dragleave: DragAndDrop.dropTargetOnDragLeave, drop: DragAndDrop.dropTargetOnDrop }); $(".draggable").kendoDraggable({ hint: function () { return $(".draggable").clone(); }, dragstart: DragAndDrop.draggableOnDragStart, dragend: DragAndDrop.draggableOnDragEnd }); }); var DragAndDrop = { draggableOnDragStart: function (e) { $(".draggable").addClass("hollow"); $(".draggable").css("cursor", "no-drop"); e.currentTarget.hide(); }, draggableOnDragEnd: function (e) { e.currentTarget.show(); }, dropTargetOnDrop: function () { alert(2); }, dropTargetOnDragEnter: function () { alert(1); $(".draggable").css("cursor", "wait"); }, dropTargetOnDragLeave: function () { alert(3); } };</script>.Columns(c => { c.Bound(col => col.ActiveBool).Width(12).Title("Active").HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" }); c.Bound(col => col.District).Width(12).Title("Dist").HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" }); c.Bound(col => col.ContractId).ClientTemplate(@Html.ActionLink("#= ContractId #", "ActiveContracts", "ActiveContracts", new { id = "#= ContractId #", @class = "visible-sm visible-lg visible-xs" }, null).ToHtmlString()).Width(16); c.Bound(col => col.Status).Width(23).HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.WorkBeginDate).Width(17).Title("Work Begin").HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.CurrentAmount).Width(20).HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.ProjectId).Width(18).HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.DescriptionTrimmed).Width(33).HtmlAttributes(new { title = "<#=Description#>" }).Title("Description").HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.County).Width(15).HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.WorkMixTrimmed).Width(22).HtmlAttributes(new { title = "<#=WorkMix#>" }).Title("Work Mix").HtmlAttributes(new { @class = "visible-lg" }); c.Bound(col => col.VendorNameTrimmed).Width(22).HtmlAttributes(new { title = "<#=VendorName#>" }).Title("Vendor Name").HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" }); c.Bound(col => col.ViewMap).Width(15).HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" }); })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)))