private void LoadData() { //Establish sql connection. string Connection = ConfigurationManager.AppSettings["ConnectionString"]; SqlConnection con = new SqlConnection(Connection); //Open database connection to connect to sql server con.Open(); DataSet ds = new DataSet(); //Navigate and get the details of careers ds = sdata.GetNewCareers(); pds.DataSource = ds.Tables[0].DefaultView; pds.AllowPaging = true; pds.PageSize = 1; //pds.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue); pds.CurrentPageIndex = CurrentPage; lnkbtnNext.Enabled = !pds.IsLastPage; lnkbtnPrevious.Enabled = !pds.IsFirstPage; DataList1.DataSource = pds; DataList1.DataBind(); doPaging(); //Close database connection to disconnect to sql server con.Close(); }