protected void a_Click(object sender, EventArgs e) { TweekPerformance_BT.Employee emp = new TweekPerformance_BT.Employee(); EmployeeBindingList.EmployeeList.Clear(); userNumbersList.Clear(); Project newProject = (Project)Application["newProject"]; emp.SearchEmployees(search.Text, newProject.ProjectStartDateTime); List<Employees> myList = new List<Employees>(); foreach (TweekPerformance_BT.Employee inE in EmployeeBindingList.EmployeeList) { userNumbersList.Add(inE.UserNumber); Employees a = new Employees(); a.FirstName = inE.FirstName; a.Surname = inE.Surname; a.ContactNumber = inE.ContactNumber; myList.Add(a); } gvwStudents.DataSource = myList; gvwStudents.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if(Application["newProject"] != null) { Project newProject = (Project)Application["newProject"]; TweekPerformance_BT.Employee emp = new TweekPerformance_BT.Employee(); emp.SearchEmployees("", newProject.ProjectStartDateTime); List<Employees> myList = new List<Employees>(); //Loads the DataGridView foreach (TweekPerformance_BT.Employee inE in EmployeeBindingList.EmployeeList) { userNumbersList.Add(inE.UserNumber); Employees a = new Employees(); a.FirstName = inE.FirstName; a.Surname = inE.Surname; a.ContactNumber = inE.ContactNumber; myList.Add(a); } gvwStudents.DataSource = myList; gvwStudents.DataBind(); } else { Response.Redirect("./ViewProjectRequests"); } }