title: update model with ajax in razor
body: <p>i write this code with ajax to delete some info after that i update my updateAjax div with ajax for refreshing content and this view have masterpage.in picture u see what happen.
  <img src="https://i.stack.imgur.com/poju2.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/ZbSnu.png" alt="enter image description here"></p>
  
  <p>this is my code</p>
  
  <pre><code>@using Common.UsersManagement.Entities;
  @model IEnumerable&lt;VwUser&gt;
  @{
      Layout = "~/Views/Shared/Master.cshtml";
  }
  
  &lt;form id="userForm"&gt;
      &lt;div id="updateAjax"&gt;
          @if (string.IsNullOrWhiteSpace(ViewBag.MessageResult) == false)
          {
              &lt;div class="@ViewBag.cssClass"&gt;
                  @Html.Label(ViewBag.MessageResult as string)
              &lt;/div&gt;
              &lt;br /&gt;
          }
          &lt;table class="table" cellspacing="0"&gt;
              @foreach (VwUser Item in Model)
              {   
                  &lt;tr class="@(Item.IsActive ? "tRow" : "Disable-tRow")"&gt;
                      &lt;td class="tbody"&gt;
                          &lt;input type="checkbox" id="@Item.Id" name="selected"  value="@Item.FullName"/&gt;&lt;/td&gt;
                      &lt;td class="tbody"&gt;@Item.FullName&lt;/td&gt;
                      &lt;td class="tbody"&gt;@Item.Post&lt;/td&gt;
                      &lt;td class="tbody"&gt;@Item.Education&lt;/td&gt;
                  &lt;/tr&gt;
              }
          &lt;/table&gt;
      &lt;/div&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;div class="btnContainer"&gt;
          &lt;a href="#" id="DeleteUser" class="insertBtn"&gt;delete  &lt;/a&gt;
          &lt;br /&gt;
          &lt;br /&gt;
      &lt;/div&gt;
  
      &lt;script&gt;
          $(function () {
              // function for delet info and update #updateAjax div
              $("#DeleteUser").click(function (event)  {
                  var list = [];
                  $('#userForm input:checked').each(function () {
                      list.push(this.id);
  
                  });
                  $.ajax({
                      url: '@Url.Action("DeleteUser", "UserManagement")',
                      type: 'POST',
                      contentType: 'application/json; charset=utf-8',
                      dataType: "html",
                      traditional: true,
                      data: JSON.stringify(list),
                      success: function (data, textStatus, jqXHR) {
                          $('#updateAjax').html(data);
                        //  window.location.reload()
                      },
                      error: function (data) {
                          //$('#updateAjax').html(data);
                          window.location.reload()
                      }
                  });   //end ajax
  
              });});
      &lt;/script&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>this my controller code</p>
  
  <pre><code>public ActionResult View1()
          {
              ViewBag.PageTittle = "user list";
              ViewBag.FormTittle = "user list";
              SetUserManagement();
              var Result = userManagement.SearchUsers(null);
              if (Result.Mode == Common.Extensions.ActionResultMode.Successfully)
              {
                  return View(Result.Data);
              }
              else
              {
                  return View(new VwUser());
              }
  
          }
   public ActionResult DeleteUser(string[] userId)
          {
              SetUserManagement();
              string message = "", CssClass = ""; ;
              foreach (string item in userId)
              {
                  //TODO:show Message 
                  var Result = userManagement.DeleteUser(int.Parse(item));
  
                  if (Result.Mode != Common.Extensions.ActionResultMode.Successfully)
                  {
                      var messageResult = XmlReader.FindMessagekey(Result.Mode.ToString());
                      message += messageResult.MessageContent + "&lt;br/&gt;";
                      CssClass = messageResult.cssClass;
                  }
              }
              if (string.IsNullOrEmpty(message))
              {
                  SetMessage(Common.Extensions.ActionResultMode.Successfully.ToString());
              }
              else
              {
                  ViewBag.MessageResult = message;
                  ViewBag.cssClass = CssClass;
              }
              //
              {
                  var Result = userManagement.SearchUsers(null);
                  if (Result.Mode == Common.Extensions.ActionResultMode.Successfully)
                  {
                      return View("~/Views/UserManagement/View1.cshtml", Result.Data);
                  }
                  else
                  {
                      return View("~/Views/UserManagement/View1.cshtml", new VwUser());
                  }
              }
  
          }
  </code></pre>