protected void StudentDropDownList_SelectedIndexChanged(object sender, EventArgs e) { // THIS EVENT ISN'T CALLED AND I DON'T KNOW WHY string id = StudentDropDownList.SelectedItem.ToString(); List <Student> students = dt.viewStudents(); foreach (Student s in students) { if (s.StudentID.Trim() == id.Trim()) { StudentNameLabel.Text = s.StudentName; } } courses = dt.getEnrolmentsForStudent(id); foreach (Course c in courses) { CoursesListBox.Items.Add(c.CourseName); bill += c.Cost; } CostLabel.Text = "Cost is " + bill.ToString(); StudentNameLabel.DataBind(); CoursesListBox.DataBind(); CostLabel.DataBind(); }
void ReleaseDesignerOutlets() { if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } if (CostLabel != null) { CostLabel.Dispose(); CostLabel = null; } }
protected void Button1_Click(object sender, EventArgs e) { try { CoursesListBox.Items.Clear(); bill = 0; string id = StudentDropDownList.SelectedValue.ToString(); //string id = StudentDropDownList.SelectedIndex.ToString(); List <Student> students = dt.viewStudents(); foreach (Student s in students) { if (s.StudentID.Trim() == id.Trim()) { StudentNameLabel.Text = s.StudentName + "(ID = " + id + ")"; } } courses = dt.getEnrolmentsForStudent(id); foreach (Course c in courses) { CoursesListBox.Items.Add(c.CourseName); bill += c.Cost; } // This is necessary for some reason - I am obvously not understanding something // important to the life cycle of this page StudentDropDownList.Items.Clear(); foreach (Student s in students) { StudentDropDownList.Items.Add(s.StudentID); } CostLabel.Text = "Cost is " + bill.ToString(); //StudentNameLabel.DataBind(); //CoursesListBox.DataBind(); //CostLabel.DataBind(); } catch (Exception ex) { CostLabel.Text = ex.Message.ToString(); CostLabel.DataBind(); } }
private void GruparePct() { int cost = 0; centruGreutate = new int[nr_centroizi, 3]; drawLines(); int distanta; for (int i = 0; i < n; i++) { int distantaFinala = 10000; for (int j = 0; j < nr_centroizi; j++) { distanta = Convert.ToInt32(Math.Sqrt(Math.Pow((punct[i].x - centroizi[j].x), 2) + Math.Pow((punct[i].y - centroizi[j].y), 2))); if (distanta < distantaFinala) { distantaFinala = distanta; punct[i].color = centroizi[j].color; } } cost += distantaFinala; DeseneazaPunct(i); } if (cost2 > cost) { cost2 = cost; CostMicLabel.Text = $"Cel mai mic cost: {cost2}"; CostMicLabel.Update(); } else if (!oprit) { OprireLabel.Text = $"Oprire la: {cost2}"; OprireLabel.Update(); oprit = true; } drawLines(); CostLabel.Text = $"Cost: {Convert.ToInt32(cost)}"; CostLabel.Update(); }
void ReleaseDesignerOutlets() { if (CommentsView != null) { CommentsView.Dispose(); CommentsView = null; } if (CommentTextBox != null) { CommentTextBox.Dispose(); CommentTextBox = null; } if (CostLabel != null) { CostLabel.Dispose(); CostLabel = null; } if (DateLabel != null) { DateLabel.Dispose(); DateLabel = null; } if (DistanceLabel != null) { DistanceLabel.Dispose(); DistanceLabel = null; } if (DriverLabel != null) { DriverLabel.Dispose(); DriverLabel = null; } if (EndLabel != null) { EndLabel.Dispose(); EndLabel = null; } if (FromLabel != null) { FromLabel.Dispose(); FromLabel = null; } if (MakerLabel != null) { MakerLabel.Dispose(); MakerLabel = null; } if (ModelLabel != null) { ModelLabel.Dispose(); ModelLabel = null; } if (RateLabel != null) { RateLabel.Dispose(); RateLabel = null; } if (ResumeView != null) { ResumeView.Dispose(); ResumeView = null; } if (SegmentedControl != null) { SegmentedControl.Dispose(); SegmentedControl = null; } if (StartLabel != null) { StartLabel.Dispose(); StartLabel = null; } if (ToLabel != null) { ToLabel.Dispose(); ToLabel = null; } if (VehicleImage != null) { VehicleImage.Dispose(); VehicleImage = null; } }