问题
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