Pass Dynamic value into Save async declaration

2 posts, 0 answers
  1. Adam
    Adam avatar
    1 posts
    Member since:
    Jun 2016

    Posted 14 Dec 2016 Link to this post

    Hi there,

    I need to pass an upload point into the path to be able to successfully post my files:

                      .Events(e => e
                      .Async(a => a
                          .Save("UploadFile", "Storage", new { uploadpoint = "4FE69113-B190-49B4-ADDC-EB2371C6119A" })

    I want to make the GUID dynamic based off the selected value of a dropdown. Is there any way to make that route param dynamic either using a function:

    new { uploadpoint = GetUploadPoint() }

    Or by using javascript to read the selected value of my dropdown?

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2211 posts

    Posted 15 Dec 2016 Link to this post

    Hello Adam,

    You could achieve this by dynamically setting the async.saveUrl configuration property before each upload e.g. in the upload event handler.

    function onUpload(e) {
        //read DropDown value
        e.sender.options.async.saveUrl = <new save URL>;

    Dimiter Madjarov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top