private void CreateSelectNewControlsIfNeed() { if (this._displayMode != SelectNewContentTypeMode) { return; } if (this._container == null) { CreateContainer(); } _contentTypeNames = new DropDownList(); _contentTypeNames.ID = "ContentTypeNames"; var result = DropDownPartField.GetWebContentTypeList(); if (result.Count > 0) { IEnumerable <Node> nodes = result.Nodes; var gc = PortalContext.Current.ContextNode as GenericContent; foreach (var ctContent in nodes.Select(Content.Create)) { if (!gc.IsAllowedChildType(ctContent.Name)) { continue; } _contentTypeNames.Items.Add(new ListItem(ctContent.DisplayName, ctContent.Name)); } } if (_contentTypeNames.Items.Count > 0) { _newContentButton = new Button { ID = "NewContentButton", Text = HttpContext.GetGlobalResourceObject("SingleContentPortlet", "CreateNewContent") as string }; ; _newContentButton.Click += _newContentButton_Click; _container.Controls.Clear(); _container.Controls.Add(_contentTypeNames); _container.Controls.Add(_newContentButton); } else { _container.Controls.Clear(); _container.Controls.Add(new LiteralControl(SNSR.GetString("SingleContentPortlet", "NoAllowedChildTypes"))); } }
private void CreateSelectNewControlsIfNeed() { if (this._displayMode != SelectNewContentTypeMode) { return; } if (this._container == null) { CreateContainer(); } _contentTypeNames = new DropDownList(); _contentTypeNames.ID = "ContentTypeNames"; var result = DropDownPartField.GetWebContentTypeList(); if (result.Count > 0) { IEnumerable <Node> nodes = result.Nodes; foreach (var node in nodes) { var contentTypeName = node.Name; _contentTypeNames.Items.Add(new ListItem(contentTypeName, contentTypeName)); } } _newContentButton = new Button(); _newContentButton.ID = "NewContentButton"; _newContentButton.Text = HttpContext.GetGlobalResourceObject("SingleContentPortlet", "CreateNewContent") as string;; _newContentButton.Click += new EventHandler(_newContentButton_Click); _container.Controls.Clear(); _container.Controls.Add(_contentTypeNames); _container.Controls.Add(_newContentButton); }