protected void Page_PreRender(object sender, EventArgs e) { DataAbstract DA = new DataAbstract(); if (Convert.ToInt32(Session["userID"]) != 0) { userID = Convert.ToInt32(Session["userID"]); DataSet accountData = DA.returnAccounts(userID); //gets all accounts System.Data.DataTable accountsTable = accountData.Tables[0]; //table holding all account entries for the user object s = accountsTable.Rows[0].Field <object>("AcctNumber"); //sets the default account to the first of the user's accounts. LIKELY CHANGE LATER. if (Convert.ToInt64(Session["account"]) == 0) { Session["account"] = Convert.ToInt64(s); //saves the first account as the default account during the session } userID = Convert.ToInt16(Session["userID"]); //saves the Session userID to the variable on this page } else { Session["userID"] = 1; //temporary solution for demo 3/19/2017 Session["account"] = 211111110; } BudgetDS = DA.returnBoundedBudgets(Convert.ToInt64(Session["account"]), d1, d2); //Sets the source for the listview BudgetList.DataSource = BudgetDS; BudgetList.DataBind(); //LoadSubjects(); DataTable accounts = DA.returnAccounts(userID).Tables[0]; DropDownList DDL = AccountList; DDL.Items.Insert(0, new ListItem("Select Account", "0")); DDL.DataSource = accounts; DDL.DataTextField = "AcctNumber"; DDL.DataValueField = "AcctNumber"; DDL.DataBind(); DataTable categories = DA.returnCategories(userID).Tables[0]; DropDownList DDL2 = CategorySelect; DDL2.Items.Insert(0, new ListItem("Select Category", "0")); DDL2.DataSource = categories; DDL2.DataTextField = "Name"; DDL2.DataValueField = "CategoryID"; DDL2.DataBind(); }