private void LoadList() { Contacts clsContact = new Contacts(); DataClass clsDataClass = new DataClass(); ContactColumns clsContactColumns = new ContactColumns(); clsContactColumns.ContactID = true; clsContactColumns.ContactCode = true; clsContactColumns.ContactName = true; clsContactColumns.RewardDetails = true; ContactColumns clsSearchColumns = new ContactColumns(); clsSearchColumns.ContactCode = true; clsSearchColumns.ContactName = true; clsSearchColumns.RewardDetails = true; string SortField = "ContactID"; if (Request.QueryString["sortfield"]!=null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } System.Data.SqlClient.SortOrder sortoption = System.Data.SqlClient.SortOrder.Ascending; if (Request.QueryString["sortoption"]!=null) { sortoption = (System.Data.SqlClient.SortOrder) Enum.Parse(typeof(System.Data.SqlClient.SortOrder), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } string SearchKey = string.Empty; if (Request.QueryString["Search"]!=null) { SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); txtSearch.Text = SearchKey; } string strSearch = txtSearch.Text.Trim(); Constants.DateSelectionString BirthDate = (Constants.DateSelectionString)Enum.Parse(typeof(Constants.DateSelectionString), cboBirthDate.SelectedItem.Value); DateTime dteRewardExpiryDateFrom = DateTime.TryParse(txtRewardExpiryDateFrom.Text, out dteRewardExpiryDateFrom) ? dteRewardExpiryDateFrom : DateTime.MinValue; DateTime dteRewardExpiryDateTo = DateTime.TryParse(txtRewardExpiryDateTo.Text, out dteRewardExpiryDateTo) ? dteRewardExpiryDateTo : DateTime.MinValue; Int16 intRewardCardStatus = (cboRewardCardStatus.SelectedItem.Value == Constants.ALL) ? Int16.Parse("-1") : Int16.Parse(cboRewardCardStatus.SelectedItem.Value); PageData.DataSource = clsContact.CustomersWithRewards(clsContactColumns, 0, System.Data.SqlClient.SortOrder.Ascending, 0, strSearch, dteRewardExpiryDateFrom, dteRewardExpiryDateTo, BirthDate, intRewardCardStatus, SortField, sortoption).DefaultView; clsContact.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }