這是我的控制器的ActionResult不能傳遞參數從視圖控制器上MVC3
[HttpPost]
public ActionResult Add(Reservation modelo, string boton)
{
ViewBag.idClassroom = modelo.idClassroom;
ViewBag.star = modelo.start;
ViewBag.idRequester = modelo.idRequester;
if (boton.Equals("Reservar"))
if (_actions != null)
_actions.ReserveClassroom(modelo.idClassroom,modelo.start,modelo.idRequester);
return RedirectToAction("Index", "Home");
,這是我的看法
@model EvaluacionMVC.Domain.Reservation
@{
ViewBag.Title = "Add";
}
<h2>Add</h2>
<h3>El salon @Model.idClassroom va a ser reservado a las @Model.idReservation
horas</h3>
@using (Html.BeginForm())
{
//<div style="display: none">@Model.start</div>
<input name="boton" type="submit" value="Reservar" />
<input name="boton" type="submit" value="Cancelar" />
}
但是當我按下按鈕Reservar它不傳遞參數它應該喜歡idClassroom,開始日期和idRequester。
PS。對不起我的英語不是我的母語:s
標記爲答案,當你得到了solutoin .... –