0
아래 코드는 작동합니다. 컨트롤러는 업로드 위젯이 실행될 때 "테스트 값"값을받습니다.MVC 뷰에서 모델 내부의 값을 KendoUI 위젯의 컨트롤러로 전달해야합니다.
그러나 하드 코딩 된 텍스트 대신 전송해야하는이보기 내에 표시되는 모델의 키 값이 있습니다.
참고. 이것은 그리드 팝업 편집기 내의 사용자 정의 템플릿입니다.
위젯 ViewBag.Title = "Test Value";
@(Html.Kendo().Upload()
.Name("files")
.TemplateId("fileTemplate")
.Async
(a => a
.Save("Save", "OpenRecords"), new { MyRequest = ViewBag.Title })
.AutoUpload(true))
)
컨트롤러
public ActionResult Save(IEnumerable<HttpPostedFileBase> files, string MyRequest)
{
// The Name of the Upload component is "files"
if (files != null)
{
foreach (var file in files)
{
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(file.FileName);
var physicalPath = Path.Combine(Server.MapPath("~/App_Data"), fileName);
// The files are not actually saved in this demo
file.SaveAs(physicalPath);
ViewBag.FileName = fileName;
//return Content(physicalPath);
}
}
// Return an empty string to signify success
return Content("");
}