2

我有一个带有两个剑道文件上传控件的视图,(我不能使它成为一个具有多个 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)
 {
  }

我搜索但没有做太多帮助,

任何帮助,将不胜感激?

4

0 回答 0