asp.net mvc - KendoUI Upload Control not posting correctly -
using vs'12 kendoui - c# asp.net mvc ef code first internet application template
i have gotten kendo ddl ( dropdownlist ) work,
i working on post actionresult when found that
if (modelstate.isvalid)
false
when click on kendoui upload button ( 1 bound in control)
- if click on regular submitt button
<input type="submit" value="upload" id="do" class="k-button"/>
modelstate.isvalid
true, none of "upload selected files" in[httppost]
actionresult
my question simple , how post both of them controller @ once?
here little example of code ( 2 buttons )
<div> <p> <input type="submit" value="upload" id="do" class="k-button"/> </p> </div> @(html.kendo().upload() .name("attachments") .async(async => async .save("index", "imageupload") .autoupload(false) ) )
you configured upload control upload files asynchronously; therefore, doesn't post with form. if want both form data , files post @ same time same controller, need configure upload control synchronous, not async, , need add enctype="multipart/form-data"
<form/>
tag. in mvc controller, make sure 1 of parameters ienumerable<httppostedfilebase> attachments
along form data model parameter(s).
Comments
Post a Comment