void LoadUserToGroup() { User user = Magic.Sys.User.Retrieve(_session, _userId); if (user != null) { this.lblUserName.Text = user.FullName; AuthorizationRepository repository = new AuthorizationRepository(_session); IList <IUserGroup> usr2grps = repository.GetGroupsForUser(user); this.rptUserToGroup.DataSource = usr2grps; this.rptUserToGroup.DataBind(); if (usr2grps == null || usr2grps.Count <= 0) { this.rptAllGroup.DataSource = repository.GetAllGroups(); } else { this.rptAllGroup.DataSource = repository.GetAssigningGroupsForUser(user); } this.rptAllGroup.DataBind(); } }