void gLayoutBlocks_GridReorder(object sender, GridReorderEventArgs e) { blockService.Reorder( blockService.GetByLayoutAndPageIdAndZone(_page.Layout, null, _zoneName).ToList(), e.OldIndex, e.NewIndex, CurrentPersonId); BindGrids(); }
/// <summary> /// Handles the GridReorder event of the gPageBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { int pageId = PageParameter( "EditPage" ).AsInteger(); Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); var rockContext = new RockContext(); BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByPageAndZone( page.Id, zoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); page.FlushBlocks(); BindGrids(); }
/// <summary> /// Handles the GridReorder event of the gPageBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { using ( var rockContext = new RockContext() ) { BlockService blockService = new BlockService( rockContext ); var blocks = blockService.GetByPageAndZone( _Page.Id, _ZoneName ).ToList(); blockService.Reorder( blocks, e.OldIndex, e.NewIndex ); rockContext.SaveChanges(); } _Page.FlushBlocks(); PageUpdated = true; BindGrids(); }
/// <summary> /// Handles the GridReorder event of the gPageBlocks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param> protected void gPageBlocks_GridReorder( object sender, GridReorderEventArgs e ) { BlockService blockService = new BlockService(); int pageId = PageParameter( "EditPage" ).AsInteger() ?? 0; Rock.Web.Cache.PageCache page = Rock.Web.Cache.PageCache.Read( pageId ); string zoneName = this.PageParameter( "ZoneName" ); blockService.Reorder( blockService.GetByPageAndZone( page.Id, zoneName ).ToList(), e.OldIndex, e.NewIndex, CurrentPersonId ); BindGrids(); }