Files and routeValues in Grid popup editor

3 posts, 0 answers
  1. Richard
    Richard avatar
    10 posts
    Member since:
    Aug 2013

    Posted 10 Oct 2013 Link to this post

    I'm using a strongly-typed partial view for the Grid popup editor and have a couple questions since the upload widget is rendered when the grid's page loads (and therefore there is no real backing model):
    1. How do I specify the initially rendered files using the Files method?
    2. How do I specify a routeValue for the Save and Remove methods based on the model?
    If the control was being rendered using the correct model, I'd want the Upload call to look something like:
           .Async(async => async
               .Save("Attach", "Controller", new { entryId = Model.Id })
               .Remove("RemoveAttachment", "Controller", new { entryId = Model.Id }))
           .Files(files => {
               if (Model.Attachments != null)
                  foreach (var f in Model.Attachments)
  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2122 posts

    Posted 14 Oct 2013 Link to this post

    Hi Richard,

    Using the Model is not possible in the current scenario, since as you stated, at the time the template code is appended to the page, there is no model. This is why there is no workaround for displaying the initial files in the current scenario.

    Regarding the question about sending the additional model data to the Save/Remove actions, it could be achieved, but in a slightly different way, which is described in the following documentation page. In the edit event of the Grid, you could store the current model data in some JavaScript variable and then use it in the upload event of the Upload widget in order to attach the additional data.
    var currentModel
    function onUpload(e) { = {
            entryId: currentModel.Id
    function edit(e) {
        currentModel = e.model;

    Dimiter Madjarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET AJAX banner
  4. Richard
    Richard avatar
    10 posts
    Member since:
    Aug 2013

    Posted 05 Nov 2013 Link to this post

    Thanks, I ended up just having a new page open to create / edit new entries.
Back to Top