目前,我的Kendo上传内容如下:
@(Html.Kendo().Upload()
.Name("UploadPicker")
.TemplateId("fileTemplate")
.Async(a => a
.Save("UploadDepotLogo", "Depot",new {depotID = Model.DepotID})
.Remove("Remove", "Upload")
.AutoUpload(false)
)
)
我需要使用浏览器中的变量而不是depotID的模型,所以我想做这样的事情:
@(Html.Kendo().Upload()
.Name("UploadPicker")
.TemplateId("fileTemplate")
.Async(a => a
.Save("UploadDepotLogo", "Depot",new {depotID = $("#DepotID").val() })
.Remove("Remove", "Upload")
.AutoUpload(false)
)
)
这可能吗?
答案 0 :(得分:1)
以下是您可以做的事情:
@(Html.Kendo().Upload()
.Name("UploadPicker")
.TemplateId("fileTemplate")
.Async(a => a
.Save("UploadDepotLogo", "Depot")
.Remove("Remove", "Upload")
.AutoUpload(false)
)
.Events(events => events.Upload("onUpload"))
)
<script type="text/javascript">
function onUpload(e) {
e.data = { depotID: $("#DepotID").val() };
}
</script>