private async void SubmitAttendance_Clicked(object sender, EventArgs e) { List <string> selected = new List <string>(); List <string> teachersSelected = new List <string>(); foreach (ViewCell c in Backup) { StackLayout sl = c.View as StackLayout; CheckBox cb = sl.Children[3] as CheckBox; Label l = sl.Children[0] as Label; if (cb.IsChecked && Backup.Contains(c)) { selected.Add(l.Text); } } foreach (ViewCell c in TeacherBackup) { StackLayout sl = c.View as StackLayout; CheckBox cb = sl.Children[3] as CheckBox; Label l = sl.Children[0] as Label; if (cb.IsChecked && TeacherBackup.Contains(c)) { teachersSelected.Add(l.Text); } } var answer = await DisplayAlert("Submit", "Please verify there are " + selected.Count + " students and " + teachersSelected.Count + " Teachers.", "continue", "cancel"); if (answer) { Attendance.TakeAttendance(selected, DatePicker.Date); Attendance.TakeTeacherAttendance(teachersSelected, DatePicker.Date); await Navigation.PopAsync(); } }