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

后端 未结 5 1757
夕颜
夕颜 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:40

                public ActionResult Index()
                {
                    return View();
                }
    
    
                public ActionResult Test(string Name)
                {
                    return RedirectToAction("Index");
                }
    

    Return View Directly displays your view but

    Redirect ToAction Action is performed

提交回复
热议问题