Rock.Web.UI.Controls.CheckinGroup.HandleGridEvents C# (CSharp) Method

HandleGridEvents() private method

Handles the grid events.
private HandleGridEvents ( ) : void
return void
        private void HandleGridEvents()
        {
            // manually wireup the grid events since they don't seem to do it automatically
            string eventTarget = Page.Request.Params["__EVENTTARGET"];
            if ( eventTarget.StartsWith( _gLocations.UniqueID ) )
            {
                List<string> subTargetList = eventTarget.Replace( _gLocations.UniqueID, string.Empty ).Split( new char[] { '$' }, StringSplitOptions.RemoveEmptyEntries ).ToList();
                EnsureChildControls();

                // make sure it's not a reorder event
                if ( subTargetList.Count != 0 )
                {
                    string lblAddControlId = subTargetList.Where( n => n.EndsWith( "Add" ) ).LastOrDefault();
                    if ( lblAddControlId != null )
                    {
                            AddLocation_Click( this, new EventArgs() );
                    }
                    else
                    {
                        // rowIndex is determined by the numeric suffix of the control id after the Grid, subtract 2 (one for the header, and another to convert from 0 to 1 based index)
                        int rowIndex = subTargetList.First().AsNumeric().AsInteger() - 2;
                        RowEventArgs rowEventArgs = new RowEventArgs( rowIndex, this.Locations.OrderBy( l => l.Order ).ThenBy( l => l.FullNamePath ).ToList()[rowIndex].LocationId );
                        DeleteLocation_Click( this, rowEventArgs );
                    }
                }
            }
        }