2

I have a view with two kendo file upload control,(i cant make it one control with multiple true, because they serve different purpose), and i have a form with two textboxes and one dropdown, i have a save button, on click i need to read the input control values and the user selected files from upload control and make a ajax request to controller,

                                    @(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

i have a model defined for this, as below

  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)
  {
  }

or

  public void Export(List<ReportViewModel> postData,     HttpPostedFileBase header,HttpPostedFileBase  body)
 {
  }

i searched but did not do much help,

any help would be appreciated?

G--
  • 497
  • 1
  • 8
  • 25
  • Did you think of making your uploads async and autoUpload true. So in your model you could save two temp file ids. – Seuthes Oct 10 '16 at 10:38

0 Answers0