ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Problem in PopupFormAction with Validation and MVC
Title:
B
I
{code}
?
Hi,i use Url.Awe().PopupFormAction() for open Popup and in this Popup i have: @model TestInputModel @using (Ajax.BeginForm("Create","Test",null)) { <div class="efield"> <div class="elabel"> @Html.LabelFor(o => o.Name)</div> <div class="einput"> @Html.Awe().TextBoxFor(o => o.Name) </div> @Html.ValidationMessageFor(o => o.Name) </div> } *in the TestInputModel.cs i have:* public class TestInputModel { [DisplayName("Name")] [Required(ErrorMessage = "Insert the name..")] public string Name { get; set; } } Now when i click on Save button of popup i not view Validation message and the post Method "Create" of TestController is called! if i insert in the Ajax.BEginForm block a button and click this instead i view Validation message! --- Thanks for your answer,but of course i have already try Html.BeginForm and not work in same way!not fire validation!..i have see examples ": http://demo.aspnetawesome.com/PopupFormDemo but no one is for Mvc/Razor(cshtml) used in MVC5!!..what can i do?
Save Changes
Cancel
Kondor
asked at 01 Feb 2014
you should use Html.BeginForm, not Ajax.BeginForm; there are plenty of examples for PopupForm, here's one: http://demo.aspnetawesome.com/PopupFormDemo, you can download the code
at 01 Feb 2014
Omu
there's a list of common problems that might occur, please have a look at them: http://aspnetawesome.com/learn/mvc/CommonProblems, there are several related to validation. mvc5 supports different viewengines just like all other asp.net mvc versions, in general it's no big difference you just replace the <% with @ and use _Layout.cshtml instead of Site.master; prodinner demo uses razor http://prodinner.aspnetawesome.com
at 01 Feb 2014
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK