or
.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)))
$(
"#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"…}