我尝试通过“提交”按钮将视图中的信息提交给控制器,但出现404错误。我假设这里必须使用HTTPPost方法,因此为什么将其包含在标题中,但是我无法将其传递给控制器。我已经传递了ScheduleInfo ActionResult中的字段,使用了HTTPPost并将FormMethod.Post添加到视图中的Html.BeginForm中。这是我正在使用的控制器。public class SchedulerController : Controller{ // GET: Scheduler [HttpGet] public ActionResult SchedulerIndex() { List<Values> lst = new List<Values>(); List<Values> lst2 = new List<Values>(); List<Values> lst3 = new List<Values>(); foreach (Values.Months month in Enum.GetValues(typeof(Values.Months))) { lst.Add(new Values { Month = month, IsChecked = false }); } foreach (Values.DaysOfTheWeek day in Enum.GetValues(typeof(Values.DaysOfTheWeek))) { lst2.Add(new Values { DaysOfWeek = day, IsChecked = false }); } var DaysOfTheMonth = Enumerable.Range(1, 31); foreach (var days in DaysOfTheMonth) { lst3.Add(new Values { DayOfMonth = days, IsChecked = false }); } var val = new Values(); val.Jobs = new List<SelectListItem>(); val.Jobs.Add(new SelectListItem() { Text = "Email", Value = "1", Selected = false }); val.Jobs.Add(new SelectListItem() { Text = "Backup", Value = "2", Selected = false }); val.Jobs.Add(new SelectListItem() { Text = "Start Application", Value = "3", Selected = false }); val.Jobs.Add(new SelectListItem() { Text = "Job4", Value = "4", Selected = false }); val.Jobs.Add(new SelectListItem() { Text = "Job5", Value = "5", Selected = false }); ViewBag.lst = lst; ViewBag.lst2 = lst2; ViewBag.lst3 = lst3; return View(val); }
1 回答
- 1 回答
- 0 关注
- 149 浏览
添加回答
举报
0/150
提交
取消