or
public
class
NullableFkModel
{
[ScaffoldColumn(
false
)]
public
int
Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
[UIHint(
"Fk"
)]
public
int
? FkId {
get
;
set
; }
}
@model
int
?
@(Html.Kendo()
.ComboBoxFor(m => m)
.DataValueField(
"Value"
)
.DataTextField(
"Text"
)
.BindTo(
new
[] {
new
SelectListItem() { Text =
"Joe Blow"
, Value =
"1"
},
new
SelectListItem() { Text =
"Jane Doe"
, Value =
"2"
},
new
SelectListItem() { Text =
"Batman"
, Value =
"3"
}})
.Filter(FilterType.Contains))
@(Html.Kendo()
.Grid<NullableFkModel>()
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Bound(item => item.Name);
columns.Bound(item => item.FkId);
columns.Command(command => command.Edit());
})
.DataSource(ds => ds.Ajax()
.Model(model => model.Id(m => m.Id))
.Read(read => read.Action(
"Nullable_Read"
,
"Demo"
))
.Create(create => create.Action(
"Nullable_Create"
,
"Demo"
))
.Update(update => update.Action(
"Nullable_Update"
,
"Demo"
))
)
.ToolBar(commands => commands.Create())
.Editable(edit => edit.Mode(GridEditMode.PopUp)))
@(Html.Kendo().Grid<Scan>(Model)
.Name(
"grid_Time_"
+ ViewData[
"ID"
])
.Columns(columns =>
{
columns.Bound(e => e.Timestamp).Title(
"Date"
).Width(150).Format(
"{0:dd/MM/yyyy hh:mm:ss}"
);
columns.Bound(e => e.GatewayID).Width(20);
})
.Sortable()
.Pageable()
.ClientDetailTemplateId(
"template2"
)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(30)
.Model(model =>
{
model.Id(d => d.GatewayID);
})
)
.Events(events => events.DataBound(
"dataBound"
))
)
.Read(read => read.Action(
"ReadScannedMeterByGateway"
,
"Flottes"
,
new
{ Id =
"#=GatewayID#"
,Timestamp=
"#=Timestamp#"
}))