Hi I developed a TreeView that listing groups and users in them, but for some reason I cant find the best way even googled it,
here's the Code
protected override void CreateChildControls()
{
base.CreateChildControls();
try
{
tree = new TreeView();
foreach (SPUser User in SPContext.Current.Web.Users)
{
string GroupName = FormatUserLogin(User.Name);
if (User.IsDomainGroup && GroupName != "" && DoesGroupExist(GroupName))
{
TreeNode GroupNode = new TreeNode(GroupName);
List<ADUser> ADUsers = new List<ADUser>();
ADUsers = GetUsersFromGroup(GroupName);
foreach (ADUser member in ADUsers)
{
if (member != null && member.DisplayName != "")
{
TreeNode MemberName = new TreeNode(member.DisplayName);
GroupNode.ChildNodes.Add(MemberName);
}
}
}
}
}
catch (Exception ex)
{
//loggingit
}
}
I tried adding control but still no gain
Cheers
