I have a main view which contains a partial view. The model of partial view has 1 property called "HttpPostedFileBase file", together with other properties
However when the main-view get posted, all the other properties in that model get correct value, but the "HttpPostedFileBase file" is null. I already set the name of to be the same as parameter. Also even Request.Files give me 0 number of files.
What have I done wrong?
P.S. My main-view actually has 2 partial views. One PV has the same model as main-view. The 2nd one is what I mentioned above. The model contains a list of objects and HttpPostedFileBase file. Code like this:
public class MyPartialViewModel
{
public List<MyObject> objInfos { get; set; }
public ICollection<HttpPostedFileBase> file { get; set; }
}
And in the PV I looply use @Html.EditFor(model=>model.objInfos[i]) to bind it to a template.
So in main-view post method, I could get "objInfos" list & all ojects' value correct. But just NULL for "file".