Is it possible to pass array of models from view to controller? H开发者_开发问答ow?
Suppose my model is
public class Car
{
    public string Name
    {
        get;
        set;
    }
    public int Price
    {
        get;
        set;
    }
}
And I have a <form> where user can dynamically add new cars. When he submits, I want to catch it in the action method
public ActionResult CreateCars(Car[] cars)
Is it possible?
I don't think so.
I believe you'd have to build the form as you went and catch the formcollection.
public ActionResult CreateCars(FormCollection formCollection)
And then go through all the elements of the formCollection.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论