title: ASP.NET MVC 4 DropDownList selectedindexchanged
body: <p>I'm paging using webgrid in ASP .NET MVC 4.0 but i have some trouble . RowsPerPage property webgrid i want to choose in DropDownList . Everything is OK but when i go to page 2 or page 3 ... default RowsPerPage = 5 . I know why but i can't fix it . Please help my trouble . Here my code </p>
  
  <p><strong>HomeController</strong></p>
  
  <pre><code>public class HomeController : Controller
  {
      [HttpGet]
      public ActionResult Index()
      {
          ViewBag.rowsPerPage = 5;
          return View(new StudentModel().ListStudent());
      }
  
      [HttpPost]
      public ActionResult Index(string model)
      {
          ViewBag.rowsPerPage = int.Parse(Request.Form["paging"].ToString());
          return View(new StudentModel().ListStudent());
      }
  
  }
  </code></pre>
  
  <p><strong>Index.cshtml</strong></p>
  
  <pre><code>@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
    &lt;link href="~/Assets/Styles/Admin/bootstrap.min.css" rel="stylesheet" /&gt;
    &lt;link href="~/Assets/Styles/Admin/HomeIndexStyle.css" rel="stylesheet" /&gt;
    &lt;script src="~/Assets/Js/jquery-1.11.3.min.js"&gt;&lt;/script&gt;
    &lt;script src="~/Assets/Js/jquery-1.11.3.js"&gt;&lt;/script&gt;
  }
  
  @model List&lt;Model.ADO.M_STUDENT&gt;
  
  @using(@Html.BeginForm()) {
    @Html.DropDownList("paging", new List&lt;SelectListItem&gt; {
      new SelectListItem{Text="1",Value="1"},
      new SelectListItem{Text="5",Value="5",Selected=true},
      new SelectListItem{Text="10",Value="10"}
    }, new { onchange = @"form.submit();"})
  }
  
  @{
    var webGird = new WebGrid(
      Model, rowsPerPage: ViewBag.rowsPerPage,
      defaultSort: "Update_At",
      columnNames: new[] { "ID", "Name", "Address", "Email", "Phone", "Status", "Update_By", "Update_At" }
    );
    webGird.SortDirection = SortDirection.Descending;
    @webGird.GetHtml(tableStyle: "table table-bordered table-hover table-striped")
  }
  </code></pre>