ASP.NET MVC CheckBoxList from model with List Property

前端 未结 4 1463
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 07:01

Apologies if the title is unclear.

I\'m trying to return my model from a form submit in ASP.NET MVC.

My question is nearly the same as this question, only di

4条回答
  •  广开言路
    2020-12-08 07:37

    From your code in the view, the post should work fine providing your post action looks like this:

    [HttpPost]
    public ActionResult Action(Model model)
    {
        return View(model);
    }
    

    i.e. passing your model across as the argument.

    Also make sure you have your model reference in the view too:

    @model YourNameSpace.Model
    

提交回复
热议问题