Your input is of type button - they do nothing without additional code on the client side.
If you want to handle the "event" on the server in the same way as in ASP.NET, you must convert it to a submit button. Assuming your controller is called "Account" and your action is called "Register", your current code will look something like this:
public ViewResult Register() { return View(); }
You want to start by passing the model into a view:
public ViewResult Register() { var registerModel = new RegisterModel(); return View(registerModel); }
Your current view uses weakly typed inputs. Since you pass it a model, you can use strongly typed views. Your model should look something like this:
public class RegisterMode { public string Firstname { get; set; } public string Surname { get; set; } }
To use strongly typed views, change your view like this:
<%using (Html.BeginForm()) { %> <%=Html.LabelFor(x => x.Firstname)%> <br/> <%=Html.TextBoxFor(x => x.Firstname)%> <br/><br/> <%=Html.LabelFor(x => x.Surname)%> <br/> <%=Html.TextBoxFor(x => x.Surname)%> <br/><br/> <input type="submit" value="Register"/> <%} %>
We were asked to create shortcuts and text fields for your RegisterModel type. This will automatically display the model values ββwhen submitting the form to the controller.
Accept the message, we need to add a new action to the controller with the same name, but accept a parameter of type RegisterModel:
public ActionResult Register(RegisterModel model) {
The last thing you need to do to be safe is to add the [HttpGet] and [HttpPost] to your controller actions to control the methods they take:
[HttpGet] public ViewResult Register()
and
[HttpPost] public ActionResult Register(RegisterModel model)
I suggest you read on MVC http://www.asp.net/mvc and read the NerdDinner chapter in the "Professional MVC" section (available for free online viewing in PDF format).