protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e) { var project = PopulateProject(); if (project.Latitude == null || project.Longitude == null) { return; } if (!projectBLL.ValidateProjectCode(project.Id, project.Code)) { lblSaveError.Text = "* Your chosen project code already exists, please choose another."; lblSaveError.Visible = true; return; } var message = projectBLL.AddOrUpdateProject(project); if (string.IsNullOrWhiteSpace(message)) { RedirectToMap(); } else { lblSaveError.Text = "* " + message; lblSaveError.Visible = true; } }