我正在使用 Razor WebGrid,当单击按标题排序或单击页面链接时,我的控制器操作被重复调用。第一次它只被调用一次,但下一次它被重复调用。请任何人都可以帮忙。
[HttpGet]
public ActionResult Index(int page = 1, string sort = "GridName", string sortDir = "ASC")
{
const int pageSize = 5;
string successMessage = string.Empty;
var message = string.Empty;
int pageIndex1 = page - 1;
if (RenderFirstTime == 1)
{
GridCRUDCollection.UpdateGridModelCollection(null, pageSize, pageIndex1, sort, sortDir);
RenderFirstTime = 0;
return View(GridCRUDCollection);
}
else
{
GridCRUDCollection.UpdateGridModelCollection(null, pageSize, pageIndex1, sort, sortDir);
return PartialView("GridDetailsView", GridCRUDCollection);
}
}