[RESOLVED]View doesn't post back to controller?

Hello,

I have an area inside that is a Register Controller and Register View, the controller looks like this.

   [HttpGet]
        public ActionResult Register()
        {
            var userRegister = new UserRegister();

            return View(userRegister);
        }

        [HttpPost]
        public ActionResult Register(UserRegister userRegister)
        {
            if (ModelState.IsValid)
            {
                var userProfile = new RegisterService().RegisterUser(userRegister);

                if (userProfile != null)
                {
                    new AuthenticateUser().UserLoggedIn(userProfile);

                    return RedirectToAction("UserProfile", "Profile", new { area = "Profile" });
                }
                else
                {
                    TempData["error"] = "Something went wrong with your registration, plese check the details you entered and try again";
                }
            }

            return View(userRegister);
        }

My view looks like this

  @using (Html.BeginForm("Register", "Register", FormMethod.Post))
                                    {
                                        <fieldset>
                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    @Html.TextBoxFor(m => m.Firstname, new { @id = "txtFirstname", @class = "form-control", @placeholder = "Firstname" })
                                                    <i class="ace-icon fa fa-user"></i>
                                                </span>
                                            </label>

                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    @Html.TextBoxFor(m => m.Surname, new { @id = "txtSurname", @class = "form-control", @placeholder = "Surname" })
                                                    <i class="ace-icon fa fa-user"></i>
                                                </span>
                                            </label>
                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    @Html.TextBoxFor(m => m.EmailAddress, new { @id = "txtEmailAddress", @class = "form-control", @placeholder = "Email Address" })
                                                    <i class="ace-icon fa fa-user"></i>
                                                </span>
                                            </label>
                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    @Html.TextBoxFor(m => m.Password, new { @id = "txtPassword", @class = "form-control", @placeholder = "Password", @type = "Password" })
                                                    <i class="ace-icon fa fa-lock"></i>
                                                </span>
                                            </label>
                                            <label class="block clearfix">
                                                <span class="block input-icon input-icon-right">
                                                    @Html.TextBoxFor(m => m.ConfirmPassword, new { @id = "txtConfirmPassword", @class = "form-control", @placeholder = "Confirm Password" })
                                                    <i class="ace-icon fa fa-lock"></i>
                                                </span>
                                            </label>
                                            <label class="pull-left">
                                                @*<input class="ace" type="checkbox">*@
                                                @Html.CheckBoxFor(m => m.AcceptedTerms, new { @class = "ace" })
                                                <span class="lbl"> Agree to Terms and Conditions</span>
                                            </label>
                                            <div class="clearfix">
                                                <input type="button" value="Register" class="width-35 pull-right btn btn-sm btn-primary" />

                                                @*<button type="button" class="width-35 pull-right btn btn-sm btn-primary">
                                                        <i class="ace-icon fa fa-pencil"></i>
                                                        <span class="bigger-110">Register</span>
                                                    </button>*@
                                            </div>
                                            <div class="space-4"></div>
                                        </fieldset>
                                    }

Now no maatter what i do this form does not submit to the register controlller post…….. can any one see why?

<input type="button"> doesn’t perform a post. change to type="submit".

Leave a Reply