or
public class LotViewModel
{
public int LotId { get; set; }
[Display(Name = "Level")]
[Range(1, 2)]
[UIHint("LotLevel")]
public int Level { get; set; }
}
@(Html.Kendo().Grid<
LotViewModel
>()
.Name("lotGrid")
.Columns(columns =>
{
columns.Bound(x => x.LotId).Visible(false);
columns.Bound(x => x.Level);
columns.Command(command =>
{
command.Edit();
}).Width(100);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.AutoBind(true)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(m => m.LotId);
model.Field(m => m.Level).DefaultValue(1);
})
.Read(update => update.Action("GetLots", "Lot"))
.Create(update => update.Action("CreateLot", "Lot"))
.Update(update => update.Action("UpdateLot", "Lot"))
)
)
@model int
@{;
var levelOne = Model.Equals(1) ? "active btn-primary" : null;
var levelTwo = Model.Equals(2) ? "active btn-primary" : null;
var htmlField = ViewData.TemplateInfo.HtmlFieldPrefix;
}
@Html.HiddenFor(model => model)
<
div
class
=
"btn-group btn-group-@htmlField"
>
<
button
type
=
"button"
class
=
"btn btn-default @levelOne bool-@htmlField"
onclick
=
"javascript: setValue(this, 1);"
>
Level 1
</
button
>
<
button
type
=
"button"
class
=
"btn btn-default @levelTwo bool-@htmlField"
onclick
=
"javascript:setValue(this, 2);"
>
Level 2
</
button
>
</
div
>
<
script
>
function setValue(button, level) {
$('.btn-group-@htmlField button.active').removeClass('active btn-primary');
$(button).addClass('active btn-primary');
$('#@htmlField').val(level); // TODO: Set the value of the model here
}
</
script
>
[Display(Name =
"Start Date"
)]
[DataType(DataType.Date)]
public
DateTime StartDate {
get
;
set
; }
<system.web>
<globalization uiCulture=
"en-GB"
culture=
"en-GB"
/>
<head>
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta charset=
"utf-8"
/>
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link rel=
"shortcut icon"
href=
"~/Content/Images/favicon.ico"
type=
"image/x-icon"
/>
<meta name=
"accept-language"
content=
"en-GB"
/>
@Scripts.Render(
"~/bundles/jquery"
)
@Scripts.Render(
"~/bundles/bootstrap"
)
@Scripts.Render(
"~/bundles/kendo/kendoscripts"
)
@RenderSection(
"scripts"
,
false
)
@RenderSection(
"scripts2"
,
false
)
@Scripts.Render(
"~/bundles/Scripts/cultures/en"
)
@Html.Kendo().DeferredScripts()
<script type=
"text/javascript"
>
var baseLocation =
'@(Url.Content("~").TrimEnd('
/
'))'
;
$(document).ready(function () {
var data = $(
"meta[name='accept-language']"
).attr(
"content"
);
kendo.culture(data);
});
</script>
bundles.Add(
new
ScriptBundle(
"~/bundles/Scripts/cultures/en"
)
.Include(
"~/Scripts/kendo/cultures/kendo.culture.en-GB.min.js"
)
.Include(
"~/Scripts/cultures/kendo.en-GB.js"
));
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m).Deferred().HtmlAttributes(
new
{ @
class
=
"form-control k-datepicker-label-top"
}))
<
div
class
=
" col-md-3"
>
<
div
class
=
"form-group"
>
@Html.LabelFor(m => m.StartDate)
@Html.EditorFor(m => m.StartDate)
</
div
>
</
div>
@(Html.Kendo().Scheduler<VisitViewModel>()
.Name(
"scheduler"
)
.Date(DateTime.Now)
.StartTime(7, 0, 0)
.EndTime(18, 0, 0)
.Timezone(
"Etc/UTC"
)
.AllDaySlot(
false
)
.Views(views => {
views.DayView(view => view.Selected(
true
)
.WorkDayStart(8, 0, 0)
.WorkDayEnd(17, 0, 0)
.SelectedDateFormat(
"{0:dddd d/M/yyyy}"
));
})
.Resources(resource => resource
.Add(m => m.MechanicId)
.Title(
"Mechanic"
)
.Name(
"mechanic"
)
.Multiple(
false
)
.DataTextField(
"Text"
)
.DataValueField(
"Value"
)
.BindTo(GetMechanics().Select(v =>
new
{ Text = String.Format(
"{0} {1}"
, v.FirstName, v.LastName), Value = v.Id }).ToArray()))
@(Html.Kendo().Grid(Model.CareAlerts)
.Name(
"Alerts"
)
.Columns(columns =>
{
columns.Bound(p => p.AlertDate).Title(
"Date"
).Format(
"{0:d}"
);
columns.Bound(p => p.PatientName).Template(@<text>
@Html.ActionLink(@item.PatientName,
"Member"
,
new
{ id = @item.PatientASID })
</text>);
columns.Bound(p => p.AlertSummary).Title(
"Message"
);
})
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(
false
)
)
)