protected void btnSave_Click(object sender, EventArgs e) { int count = 0; int ErrorLine = 0; Models.School school = new Models.School(); for (int i = 0; i < gvResult.Rows.Count; i++) { string ID = gvResult.Rows[i].Cells[0].Text; string Name = gvResult.Rows[i].Cells[1].Text; string Lastname = gvResult.Rows[i].Cells[2].Text; string Othername = gvResult.Rows[i].Cells[4].Text; string Address = gvResult.Rows[i].Cells[5].Text; string Origin = gvResult.Rows[i].Cells[3].Text; string LGA = gvResult.Rows[i].Cells[6].Text; string DOB = gvResult.Rows[i].Cells[7].Text; string Sex = gvResult.Rows[i].Cells[8].Text; string GName = gvResult.Rows[i].Cells[9].Text; string GAddress = gvResult.Rows[i].Cells[10].Text; string GPhone = gvResult.Rows[i].Cells[11].Text; string GEmail = gvResult.Rows[i].Cells[12].Text; string Relation = gvResult.Rows[i].Cells[13].Text; var lgaid = DropDownManager.GetLGAIdByName(LGA); var relation = DropDownManager.GetRelationShipByName(Relation); var sex = DropDownManager.GetGenderByName(Sex); if (InsertStudent(Name, Lastname, Othername, DOB, sex, lgaid, Address, GName, GAddress, GPhone, GEmail, relation)) { ++count; } else { ErrorLine = Convert.ToInt32(gvResult.Rows[i].Cells[0].Text); } } DropDownManager.ShowPopUp($"{count} students was successfully added !!"); if (ErrorLine != 0) { DropDownManager.ShowPopUp("Record at Row " + ErrorLine + " was not Inserted#"); } }