我有一个带有两个kendo文件上传控件的视图,(我不能让它成为一个多个true的控件,因为它们用于不同的目的),我有一个带有两个文本框和一个下拉列表的表单,我有一个保存按钮,点击我需要从上传控件读取输入控件值和用户选择的文件,并向控制器发出ajax请求,
@(Html.Kendo().Upload()
.Name("header")
.Multiple(false)
.HtmlAttributes(new { accept = ".pptx" }).Messages(m => m.Select("Browse"))
.Async(a => a
//.Save("UploadFile","UserSave")
.AutoUpload(false))
//.Events(e => e.Complete("UploadComplete").Select("SelectionComplete").Success("Success").Error("Error"))
)
@(Html.Kendo().Upload()
.Name("body")
.Multiple(false)
.HtmlAttributes(new { accept = ".pptx" }).Messages(m => m.Select("Browse"))
.Async(a => a
//.Save("UploadFile","UserSave")
.AutoUpload(false))
)
<button class="success" id="export">save data</button>
//on click of this button pass the data as json to controller
我为此定义了一个模型,如下所示
public class ReportViewModel
{
public int id { get; set; }
public string CombinationValue { get; set; }
public int type_id { get; set; }
public string type_nm { get; set; }
}
public class UploadItem
{
public HttpPostedFileBase file { get; set; }
}
public class FinalReportViewModel
{
public List<UploadItem> UploadedFiles { get; set; }
public List<ReportViewModel> Data { get; set; }
}
//controller action to be called with parameters
public void Export(FinalReportViewModel postData)
{
}
或
public void Export(List<ReportViewModel> postData, HttpPostedFileBase header,HttpPostedFileBase body)
{
}
我搜索但没有提供太多帮助,
任何帮助都会受到赞赏吗?