protected void submit_Click(object sender, EventArgs e) { //save //Get all the data for band members int index = 0; foreach (GridViewRow row in reviewerGrid.Rows) { if (index < reviewers.Length) { if (uniqueId(((TextBox)row.Cells[1].Controls[1]).Text, index)) { reviewers[index].setName(((TextBox)row.Cells[0].Controls[1]).Text); reviewers[index].setId(((TextBox)row.Cells[1].Controls[1]).Text); reviewers[index].setCompany(((TextBox)row.Cells[2].Controls[1]).Text); } else { ((TextBox)row.Cells[1].Controls[1]).Text = "ID MUST BE UNIQUE"; return; } } else { if (uniqueId(((TextBox)row.Cells[1].Controls[1]).Text, index)) { Reviewer temp = new Reviewer(((TextBox)row.Cells[1].Controls[1]).Text); temp.setName(((TextBox)row.Cells[0].Controls[1]).Text); temp.setCompany(((TextBox)row.Cells[2].Controls[1]).Text); List<Reviewer> t = reviewers.ToList(); t.Add(temp); reviewers = t.ToArray(); } else { ((TextBox)row.Cells[1].Controls[1]).Text = "ID MUST BE UNIQUE"; return; } } index++; } save(); }
private Reviewer reviewerParser(XmlNodeReader reader) { Reviewer r = new Reviewer(reader.GetAttribute("id")); reader.Read(); reader.Read(); r.setName(reader.Value); reader.Read(); reader.Read(); //name - end tag if (reader.NodeType == XmlNodeType.EndElement) return r; reader.Read(); r.setCompany(reader.Value); return r; }