title: How do I show validation error when users submit the form without selecting anything from the drop-down list in ASP.NET MVC?
body: <p>In my ASP.NET MVC application, I have a form with drop-down list. If the user did not select a category and submitted the form, I will get exception. So How do I send validation error from the controller to the view? because I don't want to write JavaScript.</p>
  
  <p>This is the drop-down list:</p>
  
  <pre><code>@Html.DropDownListFor(m =&gt; m.Article.CategoryId, new SelectList(Model.Categories, "Id", "Name"), "Select Category", new { @class = "form-control" })
  </code></pre>
  
  <p><em>I know this way is working but I need that label (Select Category)</em></p>
  
  <pre><code> @Html.DropDownListFor(m =&gt; m.Article.CategoryId, new SelectList(Model.Categories, "Id", "Name"), null, new { @class = "form-control" })
  </code></pre>
  
  <p><strong>All and New controllers:</strong></p>
  
  <pre><code>       [HttpPost]
         public ActionResult New(Article article)
          {
  
              if(ModelState.IsValid)
              {
                  string FullName = HttpContext.GetOwinContext()
                      .GetUserManager&lt;ApplicationUserManager&gt;()
                      .FindById(User.Identity.GetUserId()).FullName;
  
                  article.AuthorName = FullName;
                  article.UserId = User.Identity.GetUserId();
                  db.Aricles.Add(article);
                  db.SaveChanges();
                  return RedirectToAction("All");
              }
           }
  
          public ActionResult All()
          {
              var Articles = db.Aricles.ToList();
              return View(Articles);
          }
  </code></pre>
  
  <p><strong>My model:</strong></p>
  
  <pre><code>  public class Article
  {
      public int Id { get; set; }
      [Required]
      public string Title { get; set; }
      [Required]
      public string Body { get; set; }
      public string UserId { get; set; }
      public string AuthorName { get; set; }
      public ApplicationUser User { get; set; }
      public Category Category { get; set; }
      public int CategoryId { get; set; }
  }
  </code></pre>
  
  <p>I tried to use <strong>[Required]</strong> attribute but I don't know why it does not work. 
  <br/>
  This is a screenshot of the exception <a href="https://i.stack.imgur.com/qq7st.png" rel="nofollow noreferrer">click</a></p>