protected void Submit_Click(object sender, EventArgs e) { if (!IsValid) { return; } Club club; if (Submit.CommandName == CMD_UPDATE) { club = ClubRepository.FindById(DataUtility.ParseInt(QsClubId)); PopulateClubFromControls(club); ClubRepository.Update(club); } else if (Submit.CommandName == CMD_INSERT) { club = new Club(); PopulateClubFromControls(club); ClubRepository.Save(club); } Response.Redirect(Cancel.NavigateUrl); }