protected void rptrCodes_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "DeleteRecord") { var key = int.Parse(e.CommandArgument.ToString()); try { var obj = new DAL.Codes(); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { obj.FetchObject(key).Delete(); ShowDD(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = SRPResources.DeleteOK; } } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) { masterPage.PageError = message; } } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } } }