Domanda

@model mymodelsnamespace

    @using (Html.BeginForm("MyMethodName", "MyContollerName", FormMethod.Post)) 
    {
         @Html.EditorFor(m => Model, "Submit", new { multiple = true }) 
        <input type="submit" value="Submit" />
    }

I know the code I am going write will be close to whats above

How do I passed the updated model into MyMethodName is i can continue to manipulate it in my controller?

Please provide the signature for MyMethodName and the cshtml to give the model to the method in the controller.

È stato utile?

Soluzione

If you add this code to your controller, it should work.

[HttpPost]
public ActionResult MyMethodName (YourModel model)
{
    ... some code here.

}

You may find the Model-View-ViewModel pattern interesting.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top