protected void btnSubmit_Click(object sender, EventArgs e) { if (ViewState["Mayor"] != null) { string[] tokens = ((string)ViewState["Mayor"]).Split(new char[] { ',' }); Candidate candidate = new Candidate(); candidate.LName = tokens[0]; candidate.FName = tokens[1]; ElectionDBClass.AddVoteToCandidate(candidate); } if (ViewState["CityCouncil"] != null) { string[] tokens = ((string)ViewState["CityCouncil"]).Split(new char[] { ',' }); Candidate candidate = new Candidate(); candidate.LName = tokens[0]; candidate.FName = tokens[1]; ElectionDBClass.AddVoteToCandidate(candidate); } if (ViewState["Superintendent"] != null) { string[] tokens = ((string)ViewState["Superintendent"]).Split(new char[] { ',' }); Candidate candidate = new Candidate(); candidate.LName = tokens[0]; candidate.FName = tokens[1]; ElectionDBClass.AddVoteToCandidate(candidate); } }