Question

I want to be able to upload a document for each row. Any ideas on how to do this?

(Html.Kendo().Grid<Model>()
.Name("Grid")
.Columns(col =>
      {
          col.Template(@<text>@(Html.Kendo().Upload()
                                                     .Name("attachments<#= ID #>")
                                                     .Multiple(false)
                                                     .Async(async => async
                                                          .Save("Save", "Controller", new { folder = "<#= ID #>" })
                                                         .AutoUpload(true)
                                                         )
                                                     )</text>).Title("Import");
     })
)
Was it helpful?

Solution

So for a template for a column in MVC you just set the EditorTemplateName

columns.Bound(e => e.myColumn).EditorTemplateName("uploadTemplate")

And then define the template that you want to use somewhere else on the page.

<script id="uploadTemplate" type="text/x-kendo-template">
  @(Html.Kendo().Upload()
    .Name("attachments")
    .....
    .ToClientTemplate()
  )
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top