/// <summary> /// Handles the Delete event of the gList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param> protected void gList_Delete(object sender, RowEventArgs e) { var rockContext = new RockContext(); GroupRequirementTypeService service = new GroupRequirementTypeService(rockContext); GroupRequirementType item = service.Get(e.RowKeyId); if (item != null) { string errorMessage; if (!service.CanDelete(item, out errorMessage)) { mdGridWarning.Show(errorMessage, ModalAlertType.Information); return; } service.Delete(item); rockContext.SaveChanges(); } BindGrid(); }
/// <summary> /// Handles the Delete event of the gList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param> protected void gList_Delete( object sender, RowEventArgs e ) { var rockContext = new RockContext(); GroupRequirementTypeService service = new GroupRequirementTypeService( rockContext ); GroupRequirementType item = service.Get( e.RowKeyId ); if ( item != null ) { string errorMessage; if ( !service.CanDelete( item, out errorMessage ) ) { mdGridWarning.Show( errorMessage, ModalAlertType.Information ); return; } service.Delete( item ); rockContext.SaveChanges(); } BindGrid(); }