コード例 #1
0
        public void actualizarListadoRoles()
        {
            RolService rolService = (RolService)ServiceFactory.GetService("Rol");

            this.dataGridRoles.DataSource = rolService.getAllRoles();

            List <string> encabezados = new List <string>(new string[] { "Funcionalidades", "Seleccionado" });
            List <string> autoCells   = new List <string>(new string[] { });

            foreach (DataGridViewColumn column in this.dataGridRoles.Columns)
            {
                if (encabezados.Contains(column.HeaderText))
                {
                    column.Visible = false;
                }

                if (autoCells.Contains(column.HeaderText))
                {
                    column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
            }

            this.dataGridRoles.AutoSize   = false;
            this.dataGridRoles.ScrollBars = ScrollBars.Both;
            this.dataGridRoles.ClearSelection();
        }