Calling View of different folder from Asp.net mvc4 controller

前端 未结 2 962
陌清茗
陌清茗 2021-01-03 23:28

I hava a View Name \"Message\" in the Jobs folder of Views. And I want to return that view form an action of different controller, named \"MarketController\"



        
2条回答
  •  青春惊慌失措
    2021-01-04 00:15

    You have to fill the full address for your Message view ("~/Views/Jobs/Message.cshtml"):

    [HttpPost]
    public ActionResult Save()
    {
        TempData["message"] = "Save successfully";
        return View("~/Views/Jobs/Message.cshtml");
    }
    

提交回复
热议问题