我有一个带有自定义模板的kendo上传组件,该模板将包含所选每个文件的下拉列表。用户将选择要上载的文件列表,然后使用下拉列表为上传列表中的每个项目选择上传类型。
<script id="fileTemplate" type="text/x-kendo-template">
<span class='k-progress'></span>
<div class='file-wrapper'>
<span class='file-icon #=addExtensionClass(files[0].extension)#'></span>
<h4 class='file-heading file-name-heading'>Name: #=name#</h4>
<h4 class='file-heading file-size-heading'>Size: #=size# bytes</h4>
<label></label>
<select id="uploadType" class="uploadType" name="uploadType">
<option>Unknown</option>
<option>Type A</option>
<option>Type B</option>
<option>Type C</option>
<option>Type D</option>
</select>
<button type='button' class='k-upload-action'></button>
</div>
</script>
$(document).ready(function () {
$("#files").kendoUpload({
multiple: true,
async: {
saveUrl: '@Url.Action("Save", "DataUpload")',
autoUpload: false
},
template: kendo.template($("#fileTemplate").html()),
error: onError
});
});
function onError(e)
{
???How do I get error information to use here???
}
[HttpPost]
public ActionResult Save(IEnumerable<HttpPostedFileBase> files, ???)
{
//I need to know what type was selected before I can decide what
//processing should be done for the file. So, I assume I need another
//Param that contains he type selected by the user.
return Content("");
}
我有两个问题:
如何从控制器操作中访问为每个项目设置的下拉值?
如果上传失败,我如何获取在onError方法中使用的错误信息?