for (int i = 0; i < lv_Race.Items.Count(); i++) { PaperBallotElectionENT RaceResults = new PaperBallotElectionENT(); Literal lit_RaceID = (Literal)lv_Race.Items[i].FindControl("lit_RaceID"); RaceResults.PaperBallotElectionID = Convert.ToInt32(lit_RaceID.Text); PaperBallotElectionBLL.Select(RaceResults); DropDownList dd_PollingLocationCompleted = (DropDownList)lv_Race.Items[i].FindControl("dd_PollingLocationCompleted"); RaceResults.PollingLocationCompleted = Convert.ToInt32(dd_PollingLocationCompleted.SelectedValue); resultList.Add(RaceResults); for (int a = 0; a < lv_Race.Items[i].Controls.Count; a++) { try { ListView lv_Candidates = (ListView)lv_Race.Items[i].Controls[a].FindControl("lv_Candidates"); string vals = String.Empty; for (int b = 0; b < lv_Candidates.Items.Count; b++) { CandidatesENT CandidateVotes = new CandidatesENT(); Literal lit_CandidateID = (Literal)lv_Candidates.Items[b].FindControl("lit_CandidateID"); CandidateVotes.CandidateID = Convert.ToInt32(lit_CandidateID.Text); CandidatesBLL.Select(CandidateVotes); TextBox txttmp = (TextBox)lv_Candidates.Items[b].FindControl("txt_VotesReceived"); CandidateVotes.VotesReceived = Convert.ToInt32(txttmp.Text); CandidateVotesList.Add(CandidateVotes); } } catch (Exception ex) { //lit_Message.Text += CommonBLL.BuildMessage(ex.Message, CommonENT.WebMessageTypeEnum.error); } } }