title: Validation error message not displayed in Asp.Net Core 2 MVC partial view
body: <p>I have an index page with a list of "workbooks" titles and for each workbook, there is a "share" button. When pressing the button a bootstrap model (i.e. dialog) appears which displays the title of the workbook and a textarea allowing the user to type in a sharees email addresses. </p>
  
  <p>When the user presses on the "share" button, I am calling a javascript function which calls a controller action that returns a partial view containing the modal dialog with a form inside it. The problem is that after pressing the submit button (i.e. "Share") there are no validation errors being shown to the user and I am not sure why that is. Could anyone provide some ideas, please?</p>
  
  <p><a href="https://i.stack.imgur.com/MDe01.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MDe01.png" alt="enter image description here"></a></p>
  
  <p>That is my main (<strong>index.cshtml</strong>) page:</p>
  
  <pre><code>@model DNAAnalysisCore.Models.WorkBookModel
  @{
  }
  
  @section BodyFill
  {
      &lt;script type="text/javascript"&gt;
  
          function showSharingView(title) {
              var url = "@Url.Action("ShowShareDialog", "Home")" + "?workbookTitle=" + encodeURI(title);
              $('#shareFormContainer').load(url,
                  function() {
                      $('#shareFormModal').modal("show");
                  });
          }
  
          function hideSharingView() {
              $('#shareFormModal').modal("hide");
          }
  
      &lt;/script&gt;
  
      &lt;div id="shareFormContainer" &gt;
         &lt;!--PLACEHOLDER FOR SHARE DIALOG --&gt;
      &lt;/div&gt;
  
      &lt;div class="workbook-container"&gt;
          &lt;table class="table"&gt;
              &lt;tbody&gt;
              @foreach (var workbook in Model.Workbooks)
              {
                  &lt;tr&gt;
                      &lt;td&gt;@Html.ActionLink(workbook.Name, "Open", "OpenAnalytics", new {id = Model.Id, workbook = workbook.Name})&lt;/td&gt;
                      &lt;td&gt;
                          &lt;button title="Share" class="share-button" onclick='showSharingView("@workbook.Name")'&gt;&amp;nbsp;&lt;/button&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>That is my Controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      [HttpGet]
      public IActionResult ShowShareDialog(string workbookTitle)
      {
          var shareModel = new ShareModel
          {
              Title = workbookTitle
          };
  
          return PartialView("_ShareView", shareModel);
      }
  
      [HttpPost]
      [ValidateAntiForgeryToken]
      public IActionResult ShareWorkbook(string emails, string title)
      {
          var share = new ShareModel
          {
              Emails = emails
          };
  
          // TODO EMAIL THE SHARED WORKBOOK using the 'title' of the workbook and the 'email' string value
  
          // return no content to avoid page refresh
          return NoContent();
      }
  }
  </code></pre>
  
  <p>This is my partial view/modal dialog (_ShareView):</p>
  
  <pre><code>@using DNAAnalysisCore.Resources
  @model DNAAnalysisCore.Models.ShareModel
  
  &lt;!-- Modal --&gt;
  &lt;div class="modal fade" id="shareFormModal" role="dialog"&gt;
      &lt;div class="modal-dialog modal-md"&gt;
          &lt;!-- Modal content--&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;h4 class="modal-title"&gt;Share Workbook - @Model.Title&lt;/h4&gt;
  
              &lt;/div&gt;
  
              @using (Html.BeginForm("ShareWorkbook", "Home", FormMethod.Post))
              {
              &lt;div class="modal-body"&gt;
  
                  &lt;label&gt;@BaseLanguage.Share_workbook_Instruction_text&lt;/label&gt;
                  &lt;div class="form-group"&gt;
                      &lt;textarea class="form-control" asp-for="Emails" rows="4" cols="50" placeholder="@BaseLanguage.ShareDialogPlaceholder"&gt;&lt;/textarea&gt;
                      @* TODO add client-side validation using jquery.validate.unobtrusive.js. See US268276 *@
                      &lt;span asp-validation-for="Emails" class="text-danger"&gt;&lt;/span&gt;
                  &lt;/div&gt;
  
                  &lt;input asp-for="Title" /&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="submit" onclick="hideSharingView()" class="btn btn-primary"&gt;Share&lt;/button&gt;
                  &lt;button id="btnCancelDialog" type="button" class="btn btn-default" data-dismiss="modal"&gt;Cancel&lt;/button&gt;
              &lt;/div&gt;
              }
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
  @section Scripts {
      @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
  }
  </code></pre>
  
  <p>This is my <strong>ShareModel</strong>:</p>
  
  <pre><code>public class ShareModel
  {
      [HiddenInput]
      public string Title { get; set; }
      [Required]
      public string Emails { get; set; }
  }
  </code></pre>