Hi, the validation does not seem to work correctly in ASP.NET WebPages 2. I created a form and then used the RenderPage method to render that page into another page however on submit the validation does not show, but the data inside the fields is preserved (If you use the Value attribute on HTML elements). I posted the issue on here as well:
http://forums.asp.net/t/1916968.aspx/1?Contact+Form+validation+not+showing+
I think this is the best place to raise the issue.
Comments: __EDIT: Sorry i can't attache the file this service is really slow, see code below__ HI the issue is with ASP.NET WebPages 2 Validation Class. Please see file attached to reproduce the issue do following: Create a new WebPages site copy the file I attached and run it. Submit the form, you will see the validation work. However, create a new file and using the RenderPage method render the file I attached, on submit the validation will not show. Another user raised this a few days ago: http://forums.asp.net/t/1924503.aspx/1?Validation+will+not+work+if+a+page+is+being+rendered+by+RenderPage+on+other+page CODE ``` @{ //THIS IS A SIMPLE FORM, RUN THIS PAGE AS A STANDALONE PAGE WITHOUT RAZORC AND YOU WILL SEE IT WORK. //HOWEVER IF YOU CALL IT USING THE RENDERPAGE METHOD THEN THE VALIDATION DOES NOT SHOW. var FullName = ""; var Age = ""; if (IsPost) { FullName = Request["FullName"]; Age = Request["Age"]; Validation.RequireFields("FullName", "Age"); Validation.Add("Age", Validator.Integer() ); Validation.Add("FullName", Validator.StringLength(20, 5) ); if (Validation.IsValid()) { <p>Welcome @FullName, you're @Age years old.</p> } } } <form method="post"> @Html.ValidationSummary(true) <div> <label>FullName</label> <input type="text" name="FullName"/> @Html.ValidationMessage("FullName") </div> <div> <label>Age</label> <input type="text" name="Age"/> @Html.ValidationMessage("Age") </div> <input type="submit"/> </form> ```