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.CreditDetails = true; ContactColumns clsSearchColumns = new ContactColumns(); clsSearchColumns.ContactCode = true; clsSearchColumns.ContactName = true; string SortField = "ContactCode"; 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(); //DateTime dteExpiryDateFrom = DateTime.TryParse(txtExpiryDateFrom.Text, out dteExpiryDateFrom) ? dteExpiryDateFrom : DateTime.MinValue; //DateTime dteExpiryDateTo = DateTime.TryParse(txtExpiryDateTo.Text, out dteExpiryDateTo) ? dteExpiryDateTo : DateTime.MinValue; //CreditCardStatus enumCreditCardStatus = (CreditCardStatus)Enum.Parse(typeof(CreditCardStatus), cboCreditCardStatus.SelectedItem.Value); string strSearch = txtSearch.Text.Trim(); DateTime dteExpiryDateFrom = DateTime.TryParse(txtExpiryDateFrom.Text, out dteExpiryDateFrom) ? dteExpiryDateFrom : DateTime.MinValue; DateTime dteExpiryDateTo = DateTime.TryParse(txtExpiryDateTo.Text, out dteExpiryDateTo) ? dteExpiryDateTo : DateTime.MinValue; CreditCardStatus clsCreditCardStatus = (CreditCardStatus) Enum.Parse(typeof(CreditCardStatus), cboCreditCardStatus.SelectedItem.Value); Int32 limit = 50; limit = Int32.TryParse(Session["PageSize"].ToString(), out limit) ? limit * 2 : 50; PageData.DataSource = clsContact.Guarantors(clsContactColumns, txtLastNameFrom.Text, txtLastNameTo.Text, strSearch, dteExpiryDateFrom, dteExpiryDateTo, clsCreditCardStatus, Int32.Parse(cboCreditType.SelectedItem.Value), SortField, sortoption, limit).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; }