Empty;
Working with the Repeater Control
[ 82 ]
BindPagedData(currentPageIndex, PAGESIZE);
}
else
{
filterCondition = drpDept.SelectedValue;
BindPagedData(currentPageIndex, PAGESIZE);
}
}
The value of the SelectedValue property of the DropDownList control actually
contains the name of the selected department. Accordingly, the variable
filterCondition is set to this value in the drpDept_SelectedIndexChanged
event handler.
The updated BindPagedData() method that incorporates the filtering, paging, and
sorting functionality (all in one) is as follows:
private void BindPagedData(int currentPageIndex, int pageSize)
{
ArrayList dataList = null;
DataManager dataManager = new DataManager();
PagedDataSource pagedDataSource = new PagedDataSource();
pagedDataSource.PageSize = pageSize;
pagedDataSource.CurrentPageIndex = currentPageIndex;
pagedDataSource.AllowPaging = true;
if (sortColumn == String.Empty)
{
dataList = dataManager.GetEmployees();
pagedDataSource.DataSource = dataList;
totalRecords = dataList.Count;
maxNumberOfPages = totalRecords / PAGESIZE;
}
else
{
if (filterCondition == String.Empty)
{
dataList =
dataManager.GetSortedEmployees(sortColumn);
pagedDataSource.DataSource = dataList;
totalRecords = dataList.Count;
maxNumberOfPages = totalRecords / PAGESIZE;
}
else
{
dataList =
Chapter 3
[ 83 ]
dataManager.
Pages:
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94