I have a list view that supports viewing and deleting attached files. That works just fine. The problem I am having is when I try to add a new file to the list. I have a custom editor template for the AttachedFile object, but when the editor runs the Model passed into it is empty. I have specified a default value on the field that I need to access in editor template, which I would assume would be passed to the editor.
Here is my ListView:
Here is my EditorTemplate:
The problem is the Model.EntityTableKey is empty in the editor.
What am I doing wrong? Shouldn't the default value be passed to the editor template?
Here is my ListView:
@(Html.Kendo().ListView<
AttachedFile
>()
.Name("attachedFilesListView")
.TagName("div")
.ClientTemplateId("attachedFilesTemplate")
.DataSource(dataSource => dataSource
.Model(model => {
model.Id(f => f.AttachedFileID);
model.Field(f => f.EntityTableKey).DefaultValue(Model.CorrectiveActionItemID);
})
.Read(read => read.Action("Files_Read", "CorrectiveActionItem", new { correctiveActionItemId = Model.CorrectiveActionItemID }))
.Destroy(destroy => destroy.Action("Files_Delete","CorrectiveActionItem"))
.PageSize(4)
)
.Pageable()
.Editable()
)
@model AttachedFile
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a.Save("SaveFile", "CorrectiveActionItem", new { correctiveActionItemId = Model.EntityTableKey })
.AutoUpload(true))
)
What am I doing wrong? Shouldn't the default value be passed to the editor template?