passing value from textbox to controller
asp.net-mvc
Solution
So to get the value back into the controller you're going to need to issue a `POST` first of all so you'll want to setup your controller action for a `POST`:
[HttpPost]
public ActionResult SendEmails(string EmailList)
{
}
also notice I added a parameter `EmailList` that's named exactly the same as the control on the form. Next we need to make sure your HTML is setup right, so when you build the `form` control build it like this:
@Html.BeginForm("SendEmails", "{ControllerNameHere}", FormMethod.Post)
and then your text box, well leave it alone, it should work just fine.
Problem
How can I get value from textbox "EmailList" and send it to controler? I'm always using webforms, and this is my first contact with mvc. View: ``` @Html.TextBox("EmailList") @Html.Action("SendEmails") ``` Controller: ``` public ActionResult SendEmails() { // some operations on EmailList } ``` EDIT And what if I need just to open simple method 'onclick'? Not actionresult. for example - ``` public void SendEmails() { // some operations on EmailList } ```