Hi.
I am having an used (I think) issue on grid.
"The DataKeys collection is empty. Please specify a data key."
For telerik mvc extensions it is documented issue but I don't find how to fix it with kendo MVC
My grid:
and my ViewModel:
How can I fix this in kendo mvc?
Thanks
I am having an used (I think) issue on grid.
"The DataKeys collection is empty. Please specify a data key."
For telerik mvc extensions it is documented issue but I don't find how to fix it with kendo MVC
My grid:
@(Html.Kendo().Grid(Model)
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Bound(p => p.ClientSetName).Width(100).Title(
"Client"
);
columns.Bound(p => p.IMEI).Width(100).Title(
"IMEI"
);
columns.Bound(p => p.Active).Width(200).Title(
"Active"
);
columns.Bound(p => p.Inserted).Title(
"Inserted"
);
columns.Command(commands =>
{
commands.Edit();
}).Width(200);
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"_Index"
,
"Kit"
))
)
)
public
class
KitViewModel
{
[ScaffoldColumn(
true
)]
[UIHint(
"Kit"
)]
public
Guid Id {
get
;
set
; }
[StringLength(15), Required]
[DisplayName(
"IMEI"
)]
public
string
IMEI {
get
;
set
; }
[ReadOnly(
true
)]
[DisplayName(
"Active"
)]
public
bool
Active {
get
;
set
; }
[DisplayFormat(DataFormatString =
"{0:dd MM yyyy}"
)]
[DataType(DataType.DateTime), Required]
[ReadOnly(
true
)]
[DisplayName(
"Inserted"
)]
public
DateTime Inserted {
get
;
set
; }
[DisplayFormat(DataFormatString =
"{0:dd MM yyyy}"
)]
[DataType(DataType.DateTime), Required]
[ReadOnly(
true
)]
[DisplayName(
"Updated"
)]
public
DateTime Updated {
get
;
set
; }
[UIHint(
"Client"
)]
[ScaffoldColumn(
true
)]
public
Guid ClientId {
get
;
set
; }
[DisplayName(
"Client"
)]
public
string
ClientSetName {
get
;
set
; }
}
Thanks