protected void DropDowndepartment_SelectedIndexChanged(object sender, EventArgs e) { DBFunctions db = new DBFunctions(); if (DropDowndepartment.SelectedValue == "") { return; } int deptid = int.Parse(DropDowndepartment.SelectedValue); var programs = db.getprogramslist().Where(x => x.DeptID == deptid).ToList(); Program_tbl prgrm = new Program_tbl { ProgramName = "Select Programme" }; programs.Add(prgrm); DropDownprogramme.DataSource = programs.OrderBy(x => x.ID); DropDownprogramme.DataTextField = "ProgramName"; DropDownprogramme.DataValueField = "ID"; DropDownprogramme.DataBind(); DropDownteacher.DataSource = db.getallemployee(0, db.getemployee_count(deptid), deptid); DropDownteacher.DataTextField = "Name"; DropDownteacher.DataValueField = "ID"; DropDownteacher.DataBind(); }
private void setprogrammes() { DBFunctions db = new DBFunctions(); if (DropDownDept.SelectedValue == "") { DropDownprogramme.DataSource = null; DropDownprogramme.DataTextField = ""; DropDownprogramme.DataValueField = ""; return; } int deptid = int.Parse(DropDownDept.SelectedValue); DropDownprogramme.DataSource = db.getprogramslist().Where(x => x.DeptID == deptid); DropDownprogramme.DataTextField = "ProgramName"; DropDownprogramme.DataValueField = "ID"; DropDownprogramme.DataBind(); }