/// <summary>
/// Handles the Delete event of the gContentChannels 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 gContentChannels_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
ContentChannelService contentChannelService = new ContentChannelService( rockContext );
ContentChannel contentChannel = contentChannelService.Get( e.RowKeyId );
if ( contentChannel != null )
{
string errorMessage;
if ( !contentChannelService.CanDelete( contentChannel, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
contentChannelService.Delete( contentChannel );
rockContext.SaveChanges();
}
BindGrid();
}