Rock.Web.UI.Controls.AttributeField.GetAttributeObject C# (CSharp) Method

GetAttributeObject() private method

Gets the attribute object.
private GetAttributeObject ( System.Web.UI.WebControls.GridViewRow row ) : IHasAttributes
row System.Web.UI.WebControls.GridViewRow The row.
return IHasAttributes
        private IHasAttributes GetAttributeObject(GridViewRow row)
        {
            // Get the parent grid
            var grid = row.NamingContainer as Grid;

            // check to see if there is an object list for the grid
            if ( grid != null && grid.ObjectList != null )
            {
                // If an object list exists, check to see if the associated object has attributes
                string key = grid.DataKeys[row.RowIndex].Value.ToString();
                if ( !string.IsNullOrWhiteSpace( key ) && grid.ObjectList.ContainsKey( key ) )
                {
                    return grid.ObjectList[key] as IHasAttributes;
                }
            }

            return null;
        }