How do I get the new input value from a textbox
when I click the button? I need to make it like a update
that would go to the bank.
How do I get the new input value from a textbox
when I click the button? I need to make it like a update
that would go to the bank.
The correct way to do this is through <form>
. Using MVC and Razor, it is used as follows:
@model MeuProjeto.Models.MeuModel
@using (Html.BeginForm())
{
@Html.TextBoxFor(model => model.MeuCampo)
<button type="submit">Enviar</button>
}
Obviously, this only makes sense if you have a Model defined like this:
namespace MeuProjeto.Models
{
public class MeuModel
{
public String MeuCampo { get; set; }
}
}
The Controller will receive the form data as follows:
[HttpPost]
public ActionResult MinhaAction(MeuModel model)
{
// O valor do campo em tela vai estar preenchido em
// model.MeuCampo
}