ASP .NET MVC NonAction meaning

后端 未结 10 1695
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 17:39

Can anybody please tell me why should I use NonAction? I mean say I have a form with several submit values: Update, Delete or Insert. Since all the submit buttons have the s

10条回答
  •  耶瑟儿~
    2021-01-03 18:23

    If you did not want to invoke some action methods then you have to mark it with a attribute [NonAction] or by making it private

    public ActionResult Index(){
        return View();
    }
    
    [NonAction]
    public ActionResult Countries(Listcountries){
        return View(countries);
    }
    

    you can copy the code and paste it and see the result.thanks

提交回复
热议问题