Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want created registration page for members
I created SurfaceController
public class MemberController : SurfaceController { [ChildActionOnly] [HttpGet] public ActionResult Index() { return PartialView("Registration", new MemberViewModel()); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult CreateMember(MemberViewModel model) { if (!this.ModelState.IsValid) { return CurrentUmbracoPage(); } else { return this.RedirectToUmbracoPage(CurrentPage.Parent.Id); } } }
I created partial view Registration
@inherits UmbracoViewPage<MemberViewModel> @{ Html.EnableClientValidation(true); Html.EnableUnobtrusiveJavaScript(true); } @using (Html.BeginUmbracoForm("CreateMember", "Member", FormMethod.Post, new { @class = "form-horizontal" })) { @Html.AntiForgeryToken() <div class="form-group"> <div class="col-md-6"> @Html.TextBoxFor(m => m.FirstName, new { @class = "form-control placeholder-shown", placeholder = "First Name" }) </div> <div class="col-md-6"> @Html.TextBoxFor(m => m.LastName, new { @class = "form-control placeholder-shown", placeholder = "Last Name" }) </div> </div> <div class="form-group"> <div class="col-md-12"> @Html.TextBoxFor(m => m.Email, new { @class = "form-control placeholder-shown", placeholder = "Email" }) </div> </div> <div class="form-group"> <div class="col-md-6"> @Html.TextBoxFor(m => m.Password, new { @class = "form-control placeholder-shown", placeholder = "Password" }) </div> <div class="col-md-6"> @Html.TextBoxFor(m => m.ConfirmPassword, new { @class = "form-control placeholder-shown", placeholder = "Confirm password" }) </div> </div> <div class="text-center"> <small>Tip: Use at least one number and at least 7 characters</small> </div> <div class="form-group"> <div class="text-center"> <a data-toggle="collapse" href="#promoCodeSection" aria-expanded="False" aria-controls="promoCodeSection" class="collapsed"> I have a promo code </a> </div> </div> <div id="promoCodeSection" class="form-group collapse"> <div class="col-md-7 col-center"> @Html.TextBoxFor(m => m.PromoCode, new { @class = "col-md-7 form-control placeholder-shown", placeholder = "Promotion Code" }) </div> </div> <div class="form-group"> @Html.ValidationMessageFor(x => x.AcceptedTermsOfService) <div class="small"> <label class="checkbox-inline"> @Html.CheckBoxFor(m => m.AcceptedTermsOfService) <label for="@nameof(Model.AcceptedTermsOfService)"> I have read and agree </label> </label> </div> <div class="small"> <label class="checkbox-inline"> @Html.CheckBoxFor(m => m.SubscribedToEmails) @Html.LabelFor(m => m.SubscribedToEmails) </label> </div> </div> <div class="form-group"> <button class="btn btn-primary btn-block"> <span class="enabled-content">Create my account</span> </button> </div> }
I creted Registration view
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @inherits UmbracoTemplatePage<RegistrationViewModel> @using ClientDependency.Core.Mvc @{ Layout = "Master.cshtml"; Html.RequiresCss("~/scss/registration.scss"); } <div class="content-container"> <div class="login-block"> <div class="form-group"> <img src="@Model.Content.Logo.Crops.Src" /> </div> <div class="form-group"> <h4 class="text-center">Create account</h4> </div> <div class="form-group"> @{ Html.RenderAction("Index", "Member"); } </div> </div> </div>
When I click on button I get 404 error.
Hi Grifin
Have a look at this line:
return this.RedirectToUmbracoPage(CurrentPage.Parent.Id);
What is the current page where form is placed?
Is it in the root?
Thanks,
Alex
I have problem with this code
return CurrentUmbracoPage();
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How using from
I want created registration page for members
I created SurfaceController
I created partial view Registration
I creted Registration view
When I click on button I get 404 error.
Hi Grifin
Have a look at this line:
What is the current page where form is placed?
Is it in the root?
Thanks,
Alex
I have problem with this code
is working on a reply...