Dynamicweb 8 Documentation
AddSubgroup Method
Example 

The subgroup.
Adds the given Group as a subgroup to this Group. If the given Group or this does not exist in the database, then an ArgumentException will be thrown.
Syntax
'Declaration
 
Public Sub AddSubgroup( _ 
   ByVal subgroup As Group _ 
) 
public void AddSubgroup( 
   Group subgroup 
)

Parameters

subgroup
The subgroup.
Exceptions
ExceptionDescription
System.ArgumentExceptionIf this instance is not saved first.
System.ArgumentExceptionIf the subgroup is not saved first.
Example
Adding subgroups to a GroupAdding subgroups to a Group
using Dynamicweb.eCommerce.Products;

namespace Dynamicweb.Examples.CSharp.eCommerce
{
    public class GroupAddSubgroupSample
    {
        public void CreateNewGroupsAndNestAsSubgroup()
        {
            // Create a new Group that will be the parent group
            var parentGroup = new Group();
            parentGroup.Name = "Parent group";

            // Create a new Group that will be the subgroup
            var subgroup = new Group();
            subgroup.Name = "Subgroup";

            // Save both groups to the database before creating relations
            parentGroup.Save();
            subgroup.Save();

            // Create nesting relation
            parentGroup.AddSubgroup(subgroup);
        }
    }
}

	
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Group Class
Group Members

Send Feedback