I'm trying to add an upload feature on a Kendo Window which uses forms, so a user can fill in details, attach a file, and press save - which will post to the controller and save the file and associated data and close the window.
After trying to get the upload to work using Ajax.BeginForm (as below),
i kept getting a null value (for the file parameter) and came to the conclusion that the upload control only works for Html.BeginForm (as below)
and can see the file parameter coming through when i use it.
However, using Html.BeginForm will force a reload of a page (by redirection) which I do not want to happen. Also I do not want asynchronous uploading to happen as saving the file requires some additional data on the form before it can be saved.
The controller looks like this
Currently for any other screen which does not use the Kendo Uploader, I am using Ajax.BeginForm which posts to the controller and use JavaScript to close the Kendo Window.
What is the correct way of adding a Kendo Upload control onto a Kendo Window and to save / upload the file and close the window?
And if not is there a way to emulate the Kendo Upload's async method when saving the form?
Otherwise is there a way to use Html.BeginForm on a window and stop it from redirecting to a different page?
After trying to get the upload to work using Ajax.BeginForm (as below),
@using (Ajax.BeginForm("Save", "Manage", null, new AjaxOptions {HttpMethod = "POST"}, new { enctype = "multipart/form-data", @id = "form", target = "_self" }))
i kept getting a null value (for the file parameter) and came to the conclusion that the upload control only works for Html.BeginForm (as below)
@using (Html.BeginForm("Save", "Manage", FormMethod.Post, new { enctype = "multipart/form-data" }))
and can see the file parameter coming through when i use it.
However, using Html.BeginForm will force a reload of a page (by redirection) which I do not want to happen. Also I do not want asynchronous uploading to happen as saving the file requires some additional data on the form before it can be saved.
The controller looks like this
[HttpPost]
public ActionResult Save (Model model, IEnumerable<
HttpPostedFileBase
> file)
Currently for any other screen which does not use the Kendo Uploader, I am using Ajax.BeginForm which posts to the controller and use JavaScript to close the Kendo Window.
What is the correct way of adding a Kendo Upload control onto a Kendo Window and to save / upload the file and close the window?
And if not is there a way to emulate the Kendo Upload's async method when saving the form?
Otherwise is there a way to use Html.BeginForm on a window and stop it from redirecting to a different page?