Example #1
0
        /// <summary>
        /// Bind data for this control.
        /// </summary>
        private void BindData()
        {
            // list roles of this board
            var groups = this.GetRepository <Group>().List(boardId: this.PageContext.PageBoardID);

            // set repeater data-source
            this.RoleListYaf.DataSource = groups;

            // clear cached list of roles
            this.availableRoles.Clear();

            // get all provider roles
            (from role in AspNetRolesHelper.GetAllRoles()
             let rows = groups.Select(g => g.Name == role)
                        where groups.Count == 0
                        select role).ForEach(role1 => this.availableRoles.Add(role1));

            // check if there are any roles for syncing
            if (this.availableRoles.Count > 0 && !Config.IsDotNetNuke)
            {
                // make it data-source
                this.RoleListNet.DataSource = this.availableRoles;
            }
            else
            {
                // no data-source for provider roles
                this.RoleListNet.DataSource = null;
            }

            // bind data to controls
            this.DataBind();
        }