Mariah
Mariah

Reputation: 727

How to pass values back to a mvc3 controller from a textbox(input)/dropdownlist(select), etc,?

How can I pass values back from a text box or dropdownlist or any control from a razor view back to an mvc3 controller? These values are not strongly bound so I don't have a model to bind these values to?

Upvotes: 0

Views: 725

Answers (1)

endyourif
endyourif

Reputation: 2202

This will work:

public ActionResult SubmitAction(FormCollection collection) {
     string formValue = collection["formValue"];
}

Edit:

 public ActionResult SubmitAction(ModelName model, string field1, int field2) {

}

Upvotes: 2

Related Questions