I ended up doing it as follows. works well for me:
Created a model:
public class FeeUpload
{
[Required (ErrorMessage="File Type required")]
public string fileType { get; set; }
[Required (ErrorMessage="file required")]
public HttpPostedFileBase File { get; set; }
}
:
@using (Html.BeginForm("ActionName", "ControllerName", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(false, "Please fix the following:")
<div>
<div>
@Html.DropDownListFor(model => model.fileType,
new List<SelectListItem>
{
new SelectListItem{ Text="xxx", Value = "yyy" },
new SelectListItem{ Text="xxx", Value = "yyy" },
new SelectListItem{ Text="xxx", Value = "yyy" }
}, "Select")
@*@Html.ValidationMessageFor(model => model.fileType)*@
</div>
<div>
@Html.TextBoxFor(model => model.File, new { type = "file" })
@*@Html.ValidationMessageFor(model => model.File)*@
<input type="submit" value="OK" class="button" id="btnsubmit" />
</div>
</div>
}
:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult FeesAndCostsUpload(FeeUpload feeUploadFile)
{
if (ModelState.IsValid)
{
}
return View();
}