When I click the FilterButton button, it accesses a warning every time after every click. However, the GridData action method only hits the first time. Do you know, why?
$(document).ready(function () { $('#FilterButton').click(function () { alert('button clicked'); var myGrid = jQuery("#list").jqGrid({ url: '/Data/GridData/', datatype: 'json', mtype: 'POST', ......
Here is the requested action method
[HttpPost] public JsonResult GridData(string sidx, string sord, int page, int rows, string species, string methodOfTake, string outputType, string seasons, string years) { var results = (from a in db.t_harvest_statistics_elk where a.year == "2008" && a.unit_number == 1 orderby a.id select new { a.id, a.year, a.unit_number, a.total_hunters, a.bulls, a.cows }).ToList(); int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; int totalRecords = results.Count(); int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); var pageResults = results.Skip(pageIndex * pageSize).Take(pageSize); var jsonData = new { total = totalPages, page, records = totalRecords, rows = ( from pageResult in pageResults select new { id = pageResult.id, cell = new[] { pageResult.year.ToString(), "Add", pageResult.unit_number.ToString(), pageResult.total_hunters.ToString(), pageResult.bulls.ToString(), "add", pageResult.cows.ToString(), "add", "add", "add" } }).ToArray() }; return Json(jsonData, JsonRequestBehavior.AllowGet); }