title: devexpress mvc gridview loading infinite
body: <p>I use DevExpress MVC GridView. I have problems when I click edit, new, delete, and pages on DevExpress MVC GridView, gridview show loading that infinites.</p>
  
  <p>index.cshtml</p>
  
  <pre><code>@model System.Collections.IEnumerable
  
  @{
      ViewBag.Title = "Index";
  }
  &lt;h2&gt;Index&lt;/h2&gt;
  @Html.Partial("GridViewPartial", Model)
  </code></pre>
  
  <p>GridViewPartial</p>
  
  <pre><code>@{
      var grid = Html.DevExpress().GridView(settings =&gt; {
          settings.Name = "GridView";
          settings.CallbackRouteValues = new { Controller = "GridView", Action = "GridViewPartial" };
          settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "GridView", Action = "AddNewRecordToGrid" };
          settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "GridView", Action = "DeleteRecordFromGrid" };
          settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "GridView", Action = "UpdateRecordFromGrid" };
          settings.SettingsEditing.Mode = GridViewEditingMode.PopupEditForm;
          settings.SettingsEditing.PopupEditFormModal = true;
  
          settings.CommandColumn.ShowEditButton = true;
          settings.CommandColumn.ShowDeleteButton = true;
          settings.CommandColumn.ShowNewButton = true;
          settings.CommandColumn.Visible = true;
  
          settings.KeyFieldName = "CountryID";
          settings.Columns.Add("CountryCd");
          settings.Columns.Add("Description");
  
          settings.ClientLayout = (s, e) =&gt; {
              if (e.LayoutMode == ClientLayoutMode.Loading) {
                  if (Session["GridState"] != null)
                      e.LayoutData = (string)Session["GridState"];
              } else
                  Session["GridState"] = e.LayoutData;
          };
      });
      if (ViewData["EditError"] != null) {
          grid.SetEditErrorText((string)ViewData["EditError"]);
      }
  }
  @grid.Bind(Model).GetHtml()
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>using DevExpress.Web.Mvc;
  using WebApplication1.Models;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  
  namespace WebApplication1.Controllers
  {
      public class GridViewController : Controller
      {
          public ActionResult Index()
          {
              return View(CoreHRMDataProvider.GetEditableCountries());
          }
          public ActionResult GridViewPartial() {
              return PartialView("GridViewPartial", CoreHRMDataProvider.GetEditableCountries());
          }
          [HttpPost, ValidateInput(false)]
          public ActionResult AddNewRecordToGrid(EditableCountry country) {
              if (ModelState.IsValid) {
                  try {
                      CoreHRMDataProvider.InsertCountry(country);
                  } catch (Exception e) {
                      ViewData["EditError"] = e.Message;
                  }
              } else
                  ViewData["EditError"] = "Please, correct all errors.";
              return PartialView("GridViewPartial", CoreHRMDataProvider.GetEditableCountries());
          }
          [HttpPost, ValidateInput(false)]
          public ActionResult UpdateRecordFromGrid(EditableCountry country) {
              if (ModelState.IsValid) {
                  try {
                      CoreHRMDataProvider.UpdateCountry(country);
                  } catch (Exception e) {
                      ViewData["EditError"] = e.Message;
                  }
              } else
                  ViewData["EditError"] = "Please, correct all errors.";
              return PartialView("GridViewPartial", CoreHRMDataProvider.GetEditableCountries());
          }
          [HttpPost, ValidateInput(false)]
          public ActionResult DeleteRecordFromGrid(int countryID) {
              if (countryID &gt;= 0) {
                  try {
                      CoreHRMDataProvider.DeleteCountry(countryID);
                  } catch (Exception e) {
                      ViewData["EditError"] = e.Message;
                  }
              }
              return PartialView("GridViewPartial", CoreHRMDataProvider.GetEditableCountries());
          }
      }
  }
  </code></pre>
  
  <p>Why does this happen?
  What's the solution to my problem?</p>
  
  <p>Thanks</p>