[HttpPost] public ActionResult StudentList( string StudName, string studName, DateTime BirthDay, FormCollection form, string controller, string Action, StudentModels student) { //其中StudName為aspx頁面中標簽的name屬性(StudName不區分大小寫) //其中BirthDay為頁面中標簽的name屬性(類型可自己指定【需轉換成功才可以】,這里為DateTime)同樣BirthDay不區分大小寫 //其中controller,Action為路由信息(controller,Action不區分大小寫) //FormCollection包含了post回來的信息 通過form[]來取值 //如果使用強類型綁定 可通過實體回傳值 這里實體為StudentModels //同樣可以使用Request.Form[] Request.QueryString[] Request[] 來取值 不過此Request非WebForm中的Request 這里的Request是RequestBase抽象類的實例 WebForm中Request是封裝類 HttpRequest的實例 #region 到要經過執行controller里方法后 顯示出頁面。 //return RedirectToAction("Index");//可跳出本controller //return RedirectToRoute(new {controller="Home",action="Index"});//可跳出本controller return RedirectToAction("Details",new {id=goodId });//傳參數 //Response.Redirect("Index");//只能使用本controller下的方法名稱。返回值為void //return Redirect("Index");//只能使用本controller下的方法名稱。 #endregion #region 直接顯示出對應的頁面 不經過執行controller的方法。 //return View("Index");//非本方法 //return View("~/Views/Home/Index.aspx");//這種方法是寫全路徑 #endregion return View(); }