protected void Page_Load(object sender, EventArgs e) { user = this.Page.User.Identity.GetUserId(); quote = Convert.ToDecimal(Session["quote"]); startDate = DateTime.Now; //Convert.ToDateTime(Session["startDate"]); plan = Plan.Generate(quote, 12); months = GenerateMonths.Generate(startDate, 12); MonthsList.DataSource = months; MonthsList.DataBind(); RateList.DataSource = plan; RateList.DataBind(); }
//populate the months drop down protected void populateMonthsList(string year) { db_connection db_obj = new db_connection(); db_obj.open(); string query = "SELECT DISTINCT MONTHNAME(week_start_date) AS 'Month' FROM attendance WHERE DATE_FORMAT(attendance.week_start_date, '%Y') = @year"; MySqlCommand cmd = new MySqlCommand(query, db_obj.connection); cmd.Parameters.AddWithValue("@year", year); MySqlDataReader reader = cmd.ExecuteReader(); MonthsList.DataSource = reader; MonthsList.DataTextField = "Month"; MonthsList.DataValueField = "Month"; MonthsList.DataBind(); db_obj.close(); }