My scenario is simple. A user selects a course from the dropdown and uses the fileupload to select 1 or more files. The user hits submit and the file is saved in a file directory along with file data saved in the database.
My dropdown:
@Html.LabelFor(m => m.selectedCourseID)
@Html.DropDownListFor(m => m.selectedCourseID, Model._courses)
If I use just a regular <input id="FilePath" title="upload a image" type="file" name="file" />, everything saves correctly. But, I'd rather use the Kendo Upload. If I add this:
<div class="demo-section">
@(Html.Kendo().Upload()
.Name("Images")
)
</div>
I get the following runtime error:
The ViewData item that has the key 'selectedCourseID' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'.
My viewmodel:
[Display(Name = "Select a course...")]
public int selectedCourseID { get; set; }
public IEnumerable<SelectListItem> _courses { get; set; }
Is this enough information or should I send you information? Thanks in advance.
My dropdown:
@Html.LabelFor(m => m.selectedCourseID)
@Html.DropDownListFor(m => m.selectedCourseID, Model._courses)
If I use just a regular <input id="FilePath" title="upload a image" type="file" name="file" />, everything saves correctly. But, I'd rather use the Kendo Upload. If I add this:
<div class="demo-section">
@(Html.Kendo().Upload()
.Name("Images")
)
</div>
I get the following runtime error:
The ViewData item that has the key 'selectedCourseID' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'.
My viewmodel:
[Display(Name = "Select a course...")]
public int selectedCourseID { get; set; }
public IEnumerable<SelectListItem> _courses { get; set; }
Is this enough information or should I send you information? Thanks in advance.