Calling another different view from the controller using ASP.NET MVC 4

后端 未结 5 1746
夕颜
夕颜 2020-12-05 03:58

I have a view (Index.cshtml) with a submit button. When the submit button is clicked, it calls an action (Action01) within the controller (TestController.cs) so at the end o

5条回答
  •  北海茫月
    2020-12-05 04:44

    You have to specify the name of the custom view and its related model in Controller Action method.

    public ActionResult About()
    {            
       return View("NameOfViewYouWantToReturn",Model); 
    }
    

提交回复
热议问题