/// <summary> /// Create a <see cref="System.Web.UI.WebControls.DropDownList"/> and add it into <see cref="Adf.Web.UI.BasePanelItem"/>. /// </summary> /// <param name="label">The display text of the drop-down list within <see cref="Adf.Web.UI.BasePanelItem"/>.</param> /// <param name="name">Set the identification of <see cref="System.Web.UI.WebControls.DropDownList"/> control.</param> /// <param name="width">Width of <see cref="System.Web.UI.WebControls.DropDownList"/> control.</param> /// <param name="enabled">A value indicating whether the <see cref="System.Web.UI.WebControls.DropDownList"/> control is enabled or not.</param> /// <returns>A new instance of the <see cref="Adf.Web.UI.DropDownListItem"/> class.</returns> public static ListBoxItem Create(string label, string name, int width, bool enabled = true, ListSelectionMode mode = ListSelectionMode.Single) { var l = new Label {Text = ResourceManager.GetString(label)}; var list = new ListBox { ID = Prefix + name, Enabled = enabled, Width = new Unit(width, UnitType.Ex), SelectionMode = mode }; list.PreRender += delegate { list.CssClass = (list.Enabled) ? ("DropDownList") : ("DropDownList ReadOnly"); }; return new ListBoxItem(l, list); }
public static ListBox GetListBox(string id, int rowCount, DataView dv, string dataValueField, string dataTextField, ListSelectionMode mode) { ListBox listBox = new ListBox(); listBox.ID = id; listBox.Rows = rowCount; listBox.SelectionMode = mode; listBox.DataSource = dv; listBox.DataValueField = dataValueField; listBox.DataTextField = dataTextField; listBox.DataBind(); return listBox; }
protected void Page_Load(object sender, EventArgs e) { // 判断是否多选 ListSelectionMode selectionMode = "true".Equals(this.Request["singleSelect"]) ? ListSelectionMode.Single : ListSelectionMode.Multiple; this.AllUserInfo.SelectionMode = selectionMode; // 设置根OU节点 this.rootOUUnid = RequestUtils.GetStringParameter(this.Context, "rootOUUnid", TSWEBContext.Current.CurUser.UnitUnid); this.rootOUName = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "rootOUName", TSWEBContext.Current.CurUser.UnitFullName)); this.groupType = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "groupType", "0")); this.OUUnid.Value = rootOUUnid; this.OUName.Text = rootOUName; // 绑定岗位列表 BindAllGroup(); }
protected void Page_Load(object sender, EventArgs e) { if (WebDialogueContext.Exchange == null) return; _selectMode = (ListSelectionMode)WebDialogueContext.DialogueParameters["SelectionMode"]; UniqueList<int> classIds = (UniqueList<int>)WebDialogueContext.DialogueParameters["ClassIds"]; if (classIds.Count == 1) WebDialogueContext.SendResult(classIds.GetFirst()); if (classIds.Count == 0) { WAFContext.Session.Notify(DialogueIcon.Info, "No type available"); WebDialogueContext.CloseExchange(); } MainButton btn = new MainButton(); Controls.Add(btn); btn.Text = "Select"; btn.Click += new EventHandler(list_DblClick); WebDialogueContext.AddDialogueButton(btn); addTab(0, "local", classIds); addTab(1, "system", classIds); addTab(2, "internal", classIds); }
protected void Page_Load(object sender, EventArgs e) { ListSelectionMode selectionMode = "true".Equals(this.Request["singleSelect"]) ? ListSelectionMode.Single : ListSelectionMode.Multiple; this.Options.SelectionMode = selectionMode; // 设置根OU节点 this.rootOUUnid = RequestUtils.GetStringParameter(this.Context, "rootOUUnid", TSWEBContext.Current.CurUserUnitUnid); this.rootOUName = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "rootOUName", TSWEBContext.Current.CurUser.UnitFullName)); this.userType = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "userType", null)); // 是否预加载所有符合条件的岗位信息 bool preLoadAllUserInfo = RequestUtils.GetBoolParameter(this.Context, "preLoad", false); if (preLoadAllUserInfo) { BindAllUserInfo(); } if (string.IsNullOrEmpty(userInfosJson)) { userInfosJson = JavaScriptConvert.SerializeObject(new JavaScriptArray()); } }
/// <summary> /// Initializes a new instance of the <see cref="Wilco.Web.UI.WebControls.RowSelectorField"/> class. /// </summary> public RowSelectorField() { this.allowSelectAll = true; this.selectionMode = ListSelectionMode.Single; }
/// <summary> /// Возвращает упрощенный список сущностей /// </summary> /// <param name="entityTypeCode">код типа сущности</param> /// <param name="parentEntityId">идентификатор родительской сущности</param> /// <param name="entityId">идентификатор сущности</param> /// <param name="listId">дополнительный параметр для идентификации списка</param> /// <param name="selectionMode">режим выделения списка</param> /// <param name="selectedEntitiesIDs">идентификаторы выбранных сущностей</param> /// <param name="filter"></param> /// <param name="testEntityId"></param> /// <returns>упрощенный список сущностей</returns> public static List <ListItem> SimpleList(string entityTypeCode, int parentEntityId, int?entityId, int?listId, ListSelectionMode selectionMode, int[] selectedEntitiesIDs, string filter, int testEntityId) { var itemList = new List <ListItem>(); if (entityTypeCode == EntityTypeCode.ContentGroup) { itemList = ContentRepository.GetGroupSimpleList(parentEntityId, selectedEntitiesIDs).ToList(); } else if (entityTypeCode == EntityTypeCode.Article || entityTypeCode == EntityTypeCode.ArchiveArticle) { itemList = ArticleRepository.GetSimpleList(parentEntityId, entityId, listId, selectionMode, selectedEntitiesIDs, filter, testEntityId); } else if (entityTypeCode == EntityTypeCode.Content) { itemList.AddRange(ContentRepository.GetSimpleList(parentEntityId, selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.Site) { itemList.AddRange(SiteRepository.GetSimpleList(selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.User) { itemList.AddRange(UserRepository.GetSimpleList(selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.UserGroup) { itemList.AddRange(UserGroupRepository.GetSimpleList(selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.TemplateObjectFormat) { itemList.AddRange(ObjectFormatRepository.GetObjectFormats(parentEntityId, listId, selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.Page) { itemList.AddRange(PageTemplateRepository.GetPageSimpleList(selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.StatusType) { itemList.AddRange(StatusTypeRepository.GetStatusSimpleList(selectedEntitiesIDs)); } else if (entityTypeCode == EntityTypeCode.Field) { itemList.AddRange(FieldRepository.GetList(selectedEntitiesIDs).Select(c => new ListItem(c.Id.ToString(), c.Name))); } return(itemList); }
public override void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; string[] arr; str = xml.GetAttribute("layout"); if (str != null) _layout = FieldTypes.ParseListLayoutType(str); else _layout = ListLayoutType.SingleColumn; str = xml.GetAttribute("selectionMode"); if (str != null) selectionMode = FieldTypes.ParseListSelectionMode(str); else selectionMode = ListSelectionMode.Single; OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) overflow = FieldTypes.ParseOverflowType(str); else overflow = OverflowType.Visible; str = xml.GetAttribute("margin"); if (str != null) _margin.Parse(str); str = xml.GetAttribute("align"); if (str != null) _align = FieldTypes.ParseAlign(str); str = xml.GetAttribute("vAlign"); if (str != null) _verticalAlign = FieldTypes.ParseVerticalAlign(str); if (overflow == OverflowType.Scroll) { ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) scroll = FieldTypes.ParseScrollType(str); else scroll = ScrollType.Vertical; ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); else scrollBarDisplay = ScrollBarDisplayType.Default; int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) scrollBarMargin.Parse(str); string vtScrollBarRes = null; string hzScrollBarRes = null; arr = xml.GetAttributeArray("scrollBarRes"); if (arr != null) { vtScrollBarRes = arr[0]; hzScrollBarRes = arr[1]; } SetupScroll(scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags, vtScrollBarRes, hzScrollBarRes); } else { SetupOverflow(overflow); } arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); _lineItemCount = xml.GetAttributeInt("lineItemCount"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList.Enumerator et = xml.GetEnumerator("item"); while (et.MoveNext()) { XML ix = et.Current; string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) { url = defaultItem; if (string.IsNullOrEmpty(url)) continue; } GObject obj = GetFromPool(url); if (obj != null) { AddChild(obj); str = ix.GetAttribute("title"); if (str != null) obj.text = str; str = ix.GetAttribute("icon"); if (str != null) obj.icon = str; str = ix.GetAttribute("name"); if (str != null) obj.name = str; } } }
public override void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = xml.GetAttribute("layout"); if (str != null) _layout = FieldTypes.ParseListLayoutType(str); else _layout = ListLayoutType.SingleColumn; str = xml.GetAttribute("selectionMode"); if (str != null) selectionMode = FieldTypes.ParseListSelectionMode(str); else selectionMode = ListSelectionMode.Single; OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) overflow = FieldTypes.ParseOverflowType(str); else overflow = OverflowType.Visible; ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) scroll = FieldTypes.ParseScrollType(str); else scroll = ScrollType.Vertical; ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); else scrollBarDisplay = ScrollBarDisplayType.Default; int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) scrollBarMargin.Parse(str); str = xml.GetAttribute("margin"); if (str != null) _margin.Parse(str); SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags); string[] arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList col = xml.Elements("item"); foreach (XML ix in col) { string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) url = defaultItem; if (string.IsNullOrEmpty(url)) continue; GObject obj = AddItemFromPool(url); if (obj is GButton) { ((GButton)obj).title = ix.GetAttribute("title"); ((GButton)obj).icon = ix.GetAttribute("icon"); } else if (obj is GLabel) { ((GLabel)obj).title = ix.GetAttribute("title"); ((GLabel)obj).icon = ix.GetAttribute("icon"); } } }
protected void Page_Load(object sender, EventArgs e) { _key = WebDialogueContext.GetDialogueParameter<CKeyNLR>("ContentKey", null); _classIds = WebDialogueContext.GetDialogueParameter<UniqueList<int>>("ClassIds", null); _selectionMode = WebDialogueContext.GetDialogueParameter<ListSelectionMode>("SelectionMode", ListSelectionMode.Multiple); // add all inherited classes aswell: UniqueList<int> newClassIds = new UniqueList<int>(); foreach (int id in _classIds) { MemDefContentClass clDef = WAFRuntime.Definitions.ContentClass[id]; foreach (int id2 in clDef.AllDescendantsIncThis) { if (!newClassIds.Contains(id2)) newClassIds.Add(id2); } } _classIds = newClassIds; MainButton mb = new MainButton(); mb.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnOk"); mb.Click += new EventHandler(mb_Click); Controls.Add(mb); WebDialogueContext.AddDialogueButton(mb); _paths = new List<PropertyPath>(); WMSelectFileToEditor.RetrieveAllRelevantPaths(WAFContext.Session.GetContent(_key), _paths, _classIds); _values = new List<FilePropertyValue>(); _selectedIndexes = new UniqueList<int>(); int n = 0; foreach (PropertyPath p in _paths) { _values.Add(WAFContext.Session.GetProperty<FilePropertyValue>(p)); if (Request["chk" + n] != null) _selectedIndexes.Add(n); n++; } if (_values.Count == 0) { WebDialogueContext.Session.Notify(Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentNotifyThereAreNoFile"), Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentYouMustUploadAFile")); WebDialogueContext.SendResult(new List<PropertyPath>()); } if (n > 3) { MainButton btnCheckAll = new MainButton(); btnCheckAll.Click += new EventHandler(btnCheckAll_Click); btnCheckAll.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnCheckAll"); Controls.Add(btnCheckAll); WebDialogueContext.AddDialogueButton(btnCheckAll); } }
public static List <ListItem> SimpleList(int contentId, int articleId, int fieldId, ListSelectionMode selectionMode, int[] selectedArticleIDs, string filter) => ArticleRepository.GetSimpleList(contentId, articleId, fieldId, selectionMode, selectedArticleIDs, filter, 0);
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = xml.GetAttribute("layout"); if (str != null) { _layout = FieldTypes.ParseListLayoutType(str); } else { _layout = ListLayoutType.SingleColumn; } str = xml.GetAttribute("selectionMode"); if (str != null) { selectionMode = FieldTypes.ParseListSelectionMode(str); } else { selectionMode = ListSelectionMode.Single; } OverflowType overflow; str = xml.GetAttribute("overflow"); if (str != null) { overflow = FieldTypes.ParseOverflowType(str); } else { overflow = OverflowType.Visible; } ScrollType scroll; str = xml.GetAttribute("scroll"); if (str != null) { scroll = FieldTypes.ParseScrollType(str); } else { scroll = ScrollType.Vertical; } ScrollBarDisplayType scrollBarDisplay; str = xml.GetAttribute("scrollBar"); if (str != null) { scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str); } else { scrollBarDisplay = ScrollBarDisplayType.Default; } int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags"); Margin scrollBarMargin = new Margin(); str = xml.GetAttribute("scrollBarMargin"); if (str != null) { scrollBarMargin.Parse(str); } str = xml.GetAttribute("margin"); if (str != null) { _margin.Parse(str); } SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags); string[] arr = xml.GetAttributeArray("clipSoftness"); if (arr != null) { this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1])); } _lineGap = xml.GetAttributeInt("lineGap"); _columnGap = xml.GetAttributeInt("colGap"); defaultItem = xml.GetAttribute("defaultItem"); autoResizeItem = xml.GetAttributeBool("autoItemSize", true); XMLList col = xml.Elements("item"); foreach (XML ix in col) { string url = ix.GetAttribute("url"); if (string.IsNullOrEmpty(url)) { url = defaultItem; } if (string.IsNullOrEmpty(url)) { continue; } GObject obj = AddItemFromPool(url); if (obj is GButton) { ((GButton)obj).title = ix.GetAttribute("title"); ((GButton)obj).icon = ix.GetAttribute("icon"); } else if (obj is GLabel) { ((GLabel)obj).title = ix.GetAttribute("title"); ((GLabel)obj).icon = ix.GetAttribute("icon"); } } }
public void SetSelectionMode(ListSelectionMode mode) { _obj.asList.selectionMode = mode; }
public ListBuilder SelectionMode(ListSelectionMode value) { base.Options["selectionMode"] = value; return(this); }