28 Mar 2013
09 Dec 2013
Link to this post
I'm trying to get a form to work on a view in a MVC Widget. I added in a @Html.BeginForm and seemed to be working, but has now stopped working. I see that I may need to use the @Html.BeginSitefinityForm, but I can't find what namespace it is from.
This post says to add @using Telerik.Sitefinity.UI.MVC ...but that does not work. Getting this error when I mouse over. 'System.Web.Mvc.HtmlHelper<SitefinityWebApp.Mvc.Models.LoginModel>' does not contain a definition for 'BeginSitefinityForm' and no extension method 'BeginSitefinityForm' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<SitefinityWebApp.Mvc.Models.LoginModel>' could be found (are you missing a using directive or an assembly reference?)
So, what is happening now is that I hit the home page, click on the login page, type anything into the fields and hit submit on the form and it refreshes and shows the home page, so seems to be refreshing the parent page... Code I have now is below. Any ideas?
ViewBag.Title = Model.Header;
Layout = "~/MVC/Views/Shared/_Layout.cshtml";
@using (@Html.BeginForm("Login", "Login", null, FormMethod.Post))
@Html.ValidationSummary(true, "Login failed. Check your login details.");
@Html.LabelFor(u => u.UserName)
@Html.TextBoxFor(u => u.UserName)
@Html.ValidationMessageFor(u => u.UserName)
@Html.LabelFor(u => u.Password)
@Html.PasswordFor(u => u.Password)
@Html.ValidationMessageFor(u => u.Password)
@Html.CheckBoxFor(u => u.RememberMe)
@Html.LabelFor(u => u.RememberMe)
<input type="submit" value="Log In" />
So the question here is should I be using the @Html.BeginForm or the @Html.BeginSitefinityForm? I think I am using Hybred mode as I have a cutom WebForms Masterpage behind the MVC widgets, so that would mean that I need to be using @Html.BeginSitefinityForm but then what is the correct namespace to add so that it does not error?