public Staff() { InitializeComponent(); //Hide both groupbox TR_GB.Hide(); TCC_GB.Hide(); //Hide description text TCC_Cat_Description_Text_LB.Text = ""; //Hide no result label No_result_LB.Hide(); TCC_Course_LB.Hide(); TCC_Topic_LB.Hide(); }
//Show Course topics based on the select item private void TCC_Course_LB_SelectedIndexChanged(object sender, EventArgs e) { if (TCC_Course_LB.SelectedIndex != -1) { TCC_Topic_LB.Show(); //retrieve ID of the select item. string x = SC.TCIDRec(TCC_Course_LB.SelectedItem.ToString(), "Course"); //retrieve Topic Items have the same ID as the Course ID. TCC_Topic_LB.DataSource = SC.TCNameRec(x, "Topic"); TopicName = SC.TCNameRec(x, "Topic"); //retrieve Course Description TCC_Course_Description_Text_LB.Text = SC.TCCDataDescripRetrieve("Course", TCC_Course_LB.Text.ToString()); } }
//Show Category Courses based on select item. private void TCC_Cat_LB_SelectedIndexChanged(object sender, EventArgs e) { if (TCC_Cat_LB.SelectedIndex != -1) { TCC_Course_LB.Show(); //retrieve Category select item ID string x = SC.TCIDRec(TCC_Cat_LB.SelectedItem.ToString(), "Category"); //Use the retrieved ID to search for list of Courses Name have the same ID TCC_Course_LB.DataSource = SC.TCNameRec(x, "Course"); CourseName = SC.TCNameRec(x, "Course"); //retrieve Category Description TCC_Cat_Description_Text_LB.Text = SC.TCCDataDescripRetrieve("Category", TCC_Cat_LB.Text.ToString());; //refresh Topic List Box if (TCC_Topic_LB.DataSource != null) { TCC_Topic_LB.Hide(); TCC_Topic_LB.DataSource = null; } } }