I am trying to fix this errror and was not successfull, can anyone mate help me on this error.
- public ActionResult CourseList()
- {
- var list = new List<string>() { "Private(Copyrighted)", "Public Domain", "Creative Commons Licences", "CC Attribution", "CC Attribution Share ALike", "CC Attribution Non-Commercial",
- "CC Attribution Non-Commercial Share Alike", "CC Attribution Non Directive", "CC Attribution Non-Commercial No Directives" };
-
- List<SelectListItem> select_list = new List<SelectListItem>();
-
- var query = from li in list
- select new SelectListItem()
- {
- Value = li.ToString(),
- Text = li.ToString(),
- };
- select_list = query.ToList();
- ViewBag.list = select_list;
-
- return View();
- }
- @using (Html.BeginForm("CourseList", "Home", FormMethod.Post))
- {
- <div class="form-group row">
- <label for="Content-Licence" class="col-sm-3 col-form-label">Content Licence</label>
- <div class="col-sm-5">
- @Html.DropDownListFor(m => Model.Dashboard.CourseLicence, ViewBag.list as List<SelectListItem>) // This throws an error here: no ViewData item of type.
- </div>
- </div>
-
- }
- public class RegCoursesViewModel
- {
- public eNtsaCourses Courses { get; set; }
- public eNtsaDashboardViewModel Dashboard { get; set; }
- public List<eNtsaDashboardViewModel> lsteNtsaDashboard { get; set; }
- public RegCoursesViewModel MainModel { get; set; }
-
- }