/// ----------------------------------------------------------------------------- /// <summary> /// Creates a CheckBoxColumnTemplate /// </summary> /// <returns>A CheckBoxColumnTemplate</returns> /// <history> /// [cnurse] 02/16/2006 created /// </history> /// ----------------------------------------------------------------------------- private CheckBoxColumnTemplate CreateTemplate(ListItemType type) { bool isDesignMode = false; if (HttpContext.Current == null) { isDesignMode = true; } var template = new CheckBoxColumnTemplate(type); if (type != ListItemType.Header) { template.AutoPostBack = AutoPostBack; } template.Checked = Checked; template.DataField = DataField; template.Enabled = Enabled; template.EnabledField = EnabledField; template.CheckedChanged += OnCheckedChanged; if (type == ListItemType.Header) { template.Text = HeaderText; template.AutoPostBack = true; template.HeaderCheckBox = HeaderCheckBox; } template.DesignMode = isDesignMode; return(template); }
/// <summary> /// Sets up the columns for the Grid /// </summary> private void SetUpRolesGrid() { dgRoleSelection.Columns.Clear(); var textCol = new BoundColumn { HeaderText = " ", DataField = "RoleName" }; textCol.ItemStyle.Width = Unit.Parse("150px"); dgRoleSelection.Columns.Add(textCol); var idCol = new BoundColumn { HeaderText = "", DataField = "roleid", Visible = false }; dgRoleSelection.Columns.Add(idCol); var checkCol = new TemplateColumn(); var columnTemplate = new CheckBoxColumnTemplate { DataField = "Selected" }; checkCol.ItemTemplate = columnTemplate; checkCol.HeaderText = Localization.GetString("SelectedRole"); checkCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center; checkCol.HeaderStyle.Wrap = true; dgRoleSelection.Columns.Add(checkCol); }
/// ----------------------------------------------------------------------------- /// <summary> /// Creates a CheckBoxColumnTemplate /// </summary> /// <returns>A CheckBoxColumnTemplate</returns> /// <history> /// [cnurse] 02/16/2006 created /// </history> /// ----------------------------------------------------------------------------- private CheckBoxColumnTemplate CreateTemplate(ListItemType type) { bool isDesignMode = false; if (HttpContext.Current == null) { isDesignMode = true; } var template = new CheckBoxColumnTemplate(type); if (type != ListItemType.Header) { template.AutoPostBack = AutoPostBack; } template.Checked = Checked; template.DataField = DataField; template.Enabled = Enabled; template.EnabledField = EnabledField; template.CheckedChanged += OnCheckedChanged; if (type == ListItemType.Header) { template.Text = HeaderText; template.AutoPostBack = true; template.HeaderCheckBox = HeaderCheckBox; } template.DesignMode = isDesignMode; return template; }
/// <summary> /// Sets up the columns for the Grid /// </summary> private void SetUpDataGrid() { Columns.Clear(); BoundColumn textCol = new BoundColumn(); textCol.HeaderText = ""; textCol.DataField = "RoleName"; Columns.Add( textCol ); BoundColumn idCol = new BoundColumn(); idCol.HeaderText = ""; idCol.DataField = "roleid"; idCol.Visible = false; Columns.Add( idCol ); m_Permissions = GetPermissions(); for( int i = 0; i < m_Permissions.Count; i++ ) { PermissionInfo objPermission; objPermission = (PermissionInfo)m_Permissions[i]; TemplateColumn checkCol = new TemplateColumn(); CheckBoxColumnTemplate columnTemplate = new CheckBoxColumnTemplate(); columnTemplate.DataField = objPermission.PermissionName; columnTemplate.EnabledField = objPermission.PermissionName + "_Enabled"; checkCol.ItemTemplate = columnTemplate; string locName = ""; if( objPermission.ModuleDefID > 0 ) { if( !String.IsNullOrEmpty(ResourceFile) ) { // custom permission locName = Localization.GetString( objPermission.PermissionName + ".Permission", ResourceFile ); } } else { // system permission locName = Localization.GetString( objPermission.PermissionName + ".Permission", Localization.GlobalResourceFile ); } checkCol.HeaderText = ( !String.IsNullOrEmpty(locName) ? locName : objPermission.PermissionName ).ToString(); checkCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center; checkCol.HeaderStyle.Wrap = true; Columns.Add( checkCol ); } }
/// <summary> /// Sets up the columns for the Grid /// </summary> private void SetUpRolesGrid() { dgRoleSelection.Columns.Clear(); var textCol = new BoundColumn {HeaderText = " ", DataField = "RoleName"}; textCol.ItemStyle.Width = Unit.Parse("150px"); dgRoleSelection.Columns.Add(textCol); var idCol = new BoundColumn {HeaderText = "", DataField = "roleid", Visible = false}; dgRoleSelection.Columns.Add(idCol); var checkCol = new TemplateColumn(); var columnTemplate = new CheckBoxColumnTemplate {DataField = "Selected"}; checkCol.ItemTemplate = columnTemplate; checkCol.HeaderText = Localization.GetString("SelectedRole"); checkCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center; checkCol.HeaderStyle.Wrap = true; dgRoleSelection.Columns.Add(checkCol); }