Pass Javascript/html Variable as Parameter with Kendo MVC upload control

前提是你 提交于 2020-01-03 04:33:09

问题


Have a requirement to pass additional parameter with value of parameter set from javaScript or HTML field.

Example in below case how I can pass HTML element value or Javascript variable value to uploadID.

Note: Have limitation to use ViewModel in this place.

@(Html.Kendo().Upload()
    .Name("files")
    .Async(a => a
        .Save("Save", "Upload", new { uploadID = "XXX" })
        .Remove("Remove", "Upload")
        .AutoUpload(true)
    )
)

回答1:


Try this out:

@(Html.Kendo().Upload()
    .Name("files")
    .Async(a => a
        .Save("Save", "Upload")
        .Remove("Remove", "Upload")
        .AutoUpload(true)
    )
    .Events(e => e
        .Upload(@<text>
            function(e) {    
                e.data = { uploadID: your_js_variable };
            }
        </text>)
    )
)


来源:https://stackoverflow.com/questions/42794807/pass-javascript-html-variable-as-parameter-with-kendo-mvc-upload-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!