Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter submit a form in a Area not displayed none of validation message?
    text
    copied!<p>I have a area and at this area i have a PostController, and a action with Add name for GET method and a action with Add name for POST method,after submit form i add error to modelstate BUT after postback,not displayed none of validation message and staus code is:301 Moved Permanently !!!</p> <p>my viewmodel:</p> <pre><code>public class NewPostViewModel { [Required(ErrorMessage = "Please enter title.")] public string Title { get; set; } [AllowHtml] [Required(ErrorMessage = "Please enter article content.")] public string Content { get; set; } [Required(ErrorMessage = "Please enter a tag.")] public string Tags { get; set; } public bool PublishNow { get; set; } public string PublishDate { get; set; } public string PublishTime { get; set; } } </code></pre> <p>my view:</p> <pre><code>@model Soleimanzadeh.Models.ViewModels.NewPostViewModel @{ ViewBag.Title = "Add"; Layout = MVC.Admin.Shared.Views.BaseLayout; } @using (Html.BeginForm(MVC.Admin.Post.Add(), FormMethod.Post)) { @Html.AntiForgeryToken() @Html.ValidationSummary(false, null, new { @class = "alert" }) &lt;div class="row-fluid"&gt; &lt;div class="span9"&gt; &lt;div class="row-fluid"&gt; &lt;div class="span8"&gt; @Html.TextBoxFor(np =&gt; np.Title, new { @class = "span12", placeholder = "Title" }) @Html.ValidationMessageFor(model=&gt;model.Title) &lt;/div&gt; &lt;/div&gt; &lt;div class="row-fluid"&gt; &lt;div class="span12"&gt; @Html.TextAreaFor(np =&gt; np.Content) @Html.ValidationMessageFor(model=&gt;model.Content) &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="span3"&gt; &lt;div class="row-fluid"&gt; &lt;div class="post-options-container"&gt; &lt;div class="header"&gt; Tags &lt;/div&gt; &lt;div class="content"&gt; &lt;input type="text" placeholder="tags" class="tagManager" style="width: 100px;" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row-fluid"&gt; &lt;div class="post-options-container"&gt; &lt;div class="header"&gt; Status &lt;/div&gt; &lt;div class="content"&gt; &lt;label class="checkbox"&gt; @Html.CheckBoxFor(np =&gt; np.PublishNow) Publish Now? &lt;/label&gt; &lt;div&gt; Publish Date: @Html.TextBoxFor(np =&gt; np.PublishDate, new { @class = "calcInput" }) &lt;/div&gt; &lt;div&gt; Publish Time: @Html.TextBoxFor(np =&gt; np.PublishTime, new { @class = "timeInput" }) &lt;/div&gt; &lt;div&gt; &lt;input type="submit" value="Save"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; } @*some scripts here*@ </code></pre> <p>my controller:</p> <pre><code>public partial class PostController : Controller { public virtual ActionResult Add() { var newPost = new NewPostViewModel(); return View(MVC.Admin.Post.Views.Add, newPost); } [HttpPost] [ValidateAntiForgeryToken] public virtual ActionResult Add(NewPostViewModel post) { ModelState.AddModelError("Content","Wrong"); return this.View(MVC.Admin.Post.Views.Add, post); } } </code></pre> <p>Also i use <a href="http://imperavi.com/redactor/" rel="nofollow">redactor</a> html editor for Content.</p> <hr> <p><strong>Solution:</strong></p> <p>i use <a href="http://lowercaseroutesmvc.codeplex.com/" rel="nofollow">http://lowercaseroutesmvc.codeplex.com/</a> for convert urls to lowercase,but i not enabled this tool in area section and page redirectd after submit form.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload