/// <summary> /// This method displays the indicated page. /// </summary> /// <param name="direction">Direction can be a word like next, previous last or first. Direction can also be an integer number.</param> private void GetPage(string direction) { if (Parameters.ShowPager) { if (direction == "next") { CurrentPage++; } else if (direction == "previous") { CurrentPage--; } else if (direction == "first") { CurrentPage = 1; } else if (direction == "last") { CurrentPage = TotalPages; } else { CurrentPage = Convert.ToInt32(direction); } if (CurrentPage > TotalPages) { CurrentPage = TotalPages; } if (CurrentPage < 1) { CurrentPage = 1; } if (!FilterActive) { Parameters.DataList = OriginalList.Skip((CurrentPage - 1) * Parameters.PageSize).Take(Parameters.PageSize).ToList(); } else { Parameters.DataList = FilteredList.Skip((CurrentPage - 1) * Parameters.PageSize).Take(Parameters.PageSize).ToList(); } } }