protected internal override void CreateChildControls() { ControlCollection controls = this.Controls; controls.Clear(); TypeConverter converter = TypeDescriptor.GetConverter(typeof(PartChromeState)); this._chromeState = new DropDownList(); this._chromeState.Items.Add(new ListItem(System.Web.SR.GetString("PartChromeState_Normal"), converter.ConvertToString(PartChromeState.Normal))); this._chromeState.Items.Add(new ListItem(System.Web.SR.GetString("PartChromeState_Minimized"), converter.ConvertToString(PartChromeState.Minimized))); controls.Add(this._chromeState); this._zone = new DropDownList(); WebPartManager webPartManager = base.WebPartManager; if (webPartManager != null) { WebPartZoneCollection zones = webPartManager.Zones; if (zones != null) { foreach (WebPartZoneBase base2 in zones) { ListItem item = new ListItem(base2.DisplayTitle, base2.ID); this._zone.Items.Add(item); } } } controls.Add(this._zone); this._zoneIndex = new TextBox(); this._zoneIndex.Columns = 10; controls.Add(this._zoneIndex); foreach (Control control in controls) { control.EnableViewState = false; } }
/// <summary> /// 查询数据表DB.TAB中的数据,以TAB表进行显示; /// 根据ID选取最后1000条,逆序显示 /// </summary> /// <param name="DB">数据库</param> /// <param name="TAB">表名称</param> public static void showTable(ControlCollection root, DataBase DB, string TAB, string AppendCondition = "", bool clearPre = true) { if (!isSci) { return; } if (DB.ExistTab(TAB)) { //string sql = "select * from [" + TAB + "]"; string sql = "select top 1000 * from [" + TAB + "]"; if (AppendCondition != null && !AppendCondition.Equals("")) { sql += " " + AppendCondition; } sql = sql + " order by ID desc"; Table table = DB.Execute(sql).Table(); Label label = new Label(); label.ForeColor = Color.BlueViolet; if (clearPre) { root.Clear(); // 是否清除之前包含的数据表 } label.Text = "\r\n数据表" + TAB + ":"; root.Add(label); //print("数据表" + TAB +":"); root.Add(table); } }
/// <summary> /// 查询Author支付成功的订单信息 /// </summary> /// <param name="DB">数据库</param> /// <param name="TAB">表名称</param> /// <param name="Author">用户名</param> public static void showTable(ControlCollection root, DataBase DB, string TAB, string Author, int UserType) { if (DB.ExistTab(TAB)) { //string sql = "select * from [" + TAB + "]"; string sql = "select top 1000 ID,softName,price,ext,dateTime from [" + TAB + "]"; if (UserType == 1) { sql = sql + " where ext like '%" + "author(" + Author + ")" + "%' "; // 普通用户 } sql = sql + " order by ID desc"; Table table = DB.Execute(sql).Table(); Label label = new Label(); label.ForeColor = Color.BlueViolet; label.Text = "\r\n" + "现有注册软件,详情" + ":"; root.Clear(); root.Add(label); //print("数据表" + TAB +":"); root.Add(table); } }
private void addImg(ControlCollection parent, Crocodile_RateCFGData data, string cssName = "") { if (data != null) { Panel p = new Panel(); p.BackImageUrl = "/data/image/crocodile/" + "bg_" + data.m_color + ".png"; if (string.IsNullOrEmpty(cssName)) { p.CssClass = "cDivBg"; } else { p.CssClass = cssName; } parent.Add(p); Image img = new Image(); img.ImageUrl = "/data/image/crocodile/" + data.m_icon; p.Controls.Add(img); Panel tmp = new Panel(); tmp.CssClass = "clr"; parent.Add(tmp); } }
/// <summary> /// 查询Author支付成功的订单信息 /// </summary> /// <param name="DB">数据库</param> /// <param name="TAB">表名称</param> /// <param name="Author">用户名</param> public static void showTable(ControlCollection root, DataBase DB, string TAB, string Author, string isSuccess) { if (DB.ExistTab(TAB)) { //string sql = "select * from [" + TAB + "]"; string sql = "select top 1000 ID,product,money,dateTime from [" + TAB + "]"; sql = sql + " where isSuccess='" + isSuccess + "'"; sql = sql + " and ext like '%" + "author(" + Author + ")" + "%' "; sql = sql + " order by ID desc"; Table table = DB.Execute(sql).Table(); Label label = new Label(); label.ForeColor = Color.BlueViolet; if (isSuccess.Equals("True")) { label.Text = "\r\n" + "收益详情" + ":"; } else if (isSuccess.Equals("TrueFinish")) { label.Text = "\r\n" + "历史收益" + ":"; } root.Add(label); //print("数据表" + TAB +":"); root.Add(table); } }
protected override void CreateFilterCtrl(Control NamingContainer, ControlCollection content) { var tbxFilter = new TextBox() { ID = "tbx" + ColName, Width = new Unit(95, UnitType.Percentage) }; tbxFilter.Load += new EventHandler(tbxFilter_Load); tbxFilter.TextChanged += new EventHandler(tbxFilter_TextChanged); // Laden der aktuell gültigen Filtereinstellungen //tbxFilter_Load(tbxFilter, null); content.Add(tbxFilter); var autoComplete = new AjaxControlToolkit.AutoCompleteExtender() { TargetControlID = tbxFilter.ID, ServiceMethod = _serviceMethod, ServicePath = this.ServicePath, MinimumPrefixLength = this.MinimumPrelfixLength, CompletionSetCount = this.CompletionSetCount, CompletionInterval = this.CompletionInterval, EnableCaching = AutoCompleteEnableCaching }; content.Add(autoComplete); }
public void HtmlTableRowControlCollectionAdd() { TestHtmlTable t = new TestHtmlTable(); ControlCollection c = t.GetCollection(); c.Add(new HtmlTableRow()); c.Add(new InheritedHtmlTableRow()); Assert.AreEqual(2, c.Count, "Rows"); }
/// <summary> /// Prints the macros on the main screen. /// </summary> public void PrintMacros(ControlCollection controls) { int i = 1; int top; if (tagService.AllTags.Tags != null) { foreach (Tag tag in tagService.AllTags.Tags) { if (tag.Macros != null) { foreach (Macro macro in tag.Macros) { top = GlobalConstants.buttonInitialTop + (GlobalConstants.buttonTop * i); Button button = new Button { Top = top, Left = GlobalConstants.buttonLeft, Text = $"{macro.Name} ({tag.Name})", Name = macro.Name, Tag = GlobalConstants.removableTagMacro, BackColor = ColorTranslator.FromHtml(tag.Color), Size = new Size(GlobalConstants.buttonWidth, GlobalConstants.buttonHeight), TextAlign = ContentAlignment.MiddleLeft, FlatStyle = FlatStyle.Flat }; button.FlatAppearance.BorderSize = 1; button.FlatAppearance.BorderColor = Color.Black; Button editButton = SmallButtons.GetEditButton( macro.Name, GlobalConstants.removableTagMacro, top, GlobalConstants.buttonLeft + GlobalConstants.buttonWidth ); editButton.Click += EditMacroEvent; controls.Add(editButton); Button deleteButton = SmallButtons.GetDeleteButton( macro.Name, GlobalConstants.removableTagMacro, top, GlobalConstants.buttonLeft + GlobalConstants.buttonWidth ); deleteButton.Click += RemoveMacroEvent; controls.Add(deleteButton); controls.Add(button); i++; } } } } }
public int Add(TableCell cell) { int index = cc.IndexOf(cell); if (index < 0) { cc.Add(cell); index = cc.Count; } return(index); }
internal void AddMenuItems(ControlCollection controls, IDictionary ctls) { string tmp, img; IDictionary ctl, subCtls; MenuItemTemplate menuItem; SubMenuTemplate subMenu; foreach (DictionaryEntry entry in ctls) { if ((ctl = entry.Value as IDictionary) != null) { if (((subCtls = ctl ["items"] as IDictionary) != null) && (subCtls.Count > 0)) { subMenu = new SubMenuTemplate() { ID = entry.Key + string.Empty, Description = ctl ["desc"] + string.Empty, Text = ctl ["title"] + string.Empty }; if (!string.IsNullOrEmpty(img = ctl ["img"] + string.Empty)) { subMenu.ImageUrl = img; } AddMenuItems(subMenu.Controls, subCtls); controls.Add(subMenu); } else if (!string.IsNullOrEmpty(tmp = ctl ["click"] + string.Empty)) { menuItem = new MenuItemTemplate(ctl ["title"] + string.Empty) { Description = ctl ["desc"] + string.Empty, ID = entry.Key + string.Empty }; if (!string.IsNullOrEmpty(img = ctl ["img"] + string.Empty)) { menuItem.ImageUrl = img; } menuItem.ClientOnClickScript = tmp; controls.Add(menuItem); } } else { controls.Add(new MenuSeparatorTemplate() { ID = entry.Key + string.Empty }); } } }
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding) { ControlCollection cols = Controls; chapterTitle = new ChapterTitle(); //we just add to child controls <h4>title</h4><div class='book'>...</div> int count = 2; //count++; chapterTitle.Title = ChapterTitle; // chapterTitle.LanguageCode = this.LanguageCode; cols.Add(chapterTitle); versesHolder = new ChapterHolder() { IsRightToLeft = IsRightToLeft }; cols.Add(versesHolder); ControlCollection cols2 = versesHolder.Controls; IEnumerator ie = dataSource.GetEnumerator(); while (ie.MoveNext()) { var verse = new ctVerse() { ShowSuggestion = this.ShowSuggestion }; //verse.LanguageCode = LanguageCode; //verse.IsRightToLeft = IsRightToLeft; var text = (Peshitta.Data.Models.AlineaText)ie.Current; verse.DataBind(); if (!string.IsNullOrEmpty(BookTitle)) { verse.ToolTip = string.Format("{0} {1}:{2}", BookTitle, ChapterNo, text.Alineaid); } verse.PublicationTitle = this.PublicationTitle; //here go 2 verses, normally, the same verse but for 2 languages verse.DataSource = text.Texts; verse.AlineaId = text.Alineaid; verse.BookChapterAlineaId = text.BookChapterAlineaId; //verse cols2.Add(verse); verse.DataBind(); } return(count); }
public void Restore() { if (IsValid) { _coll.Add(_ctrl); } }
protected virtual void CreatePagerFields() { // In theory (on multi-core or SMP machines), OnTotalRowCountAvailable may // be called asynchronously to this method (since it is a delegate reacting // to event in the container), so we want to protect ourselves from data // corruption here. Lock would be an overkill, since we really want to // create the list only once anyway. _createPagerFieldsRunning = true; ControlCollection controls = Controls; controls.Clear(); DataPagerFieldItem control; foreach (DataPagerField dpf in _fields) { control = new DataPagerFieldItem(dpf, this); controls.Add(control); if (dpf.Visible) { dpf.CreateDataPagers(control, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(dpf)); control.DataBind(); } } _createPagerFieldsRunning = false; }
private async Task Form1_LoadAsync(object sender, EventArgs e) { if (File.Exists("cookie")) { StreamHelper.ReadCookiesFromDisk("cookie"); this.Json = await tsdmHelper.UserInfoAsync(); } else { Visible = true; Stream = await tsdmHelper.VerifyCodeAsync(); } Json json = await tsdmHelper.GetForumAsync(""); foreach (var str in json.group) { Button btn = new Button { Name = "btn" + str.gid.ToString() , Text = str.title.ToString() , AutoSize = true , Tag = str.gid.ToString() }; ControlCollection.Add(btn); } }
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding) { //var bookTitleholder = new BookTitle(); //bookTitleholder.Title = BookTitle; //Controls.Add(bookTitleholder); bibleBook = new BibleBookHolder(); // bibleBook.IsRightToLeft = IsRightToLeft; ControlCollection cols = bibleBook.Controls; Controls.Add(bibleBook); int count = 0; IEnumerator ie = dataSource.GetEnumerator(); int chp = StartingChapter; if (chp == 0) { chp++; } var chapterVerses = new List <AlineaText>(); Chapter ctChapter = null; while (ie.MoveNext()) { var verses = (AlineaText)ie.Current; if (ctChapter == null || verses.Alineaid == 1) { if (ctChapter != null && chapterVerses.Count > 0) { ctChapter.DataSource = chapterVerses; ctChapter.DataBind(); chapterVerses = new List <AlineaText>(); } ctChapter = new Chapter() { IsRightToLeft = IsRightToLeft, ShowSuggestion = this.ShowSuggestion, //ctChapter.LanguageCode = LanguageCode; PublicationTitle = PublicationTitle, //TODO: chp must increment to real chapters ChapterNo = chp, BookTitle = BookTitle, ChapterTitle = string.Format("Hoofdstuk {0}", chp++) }; cols.Add(ctChapter); count++; } chapterVerses.Add(verses); } if (ctChapter != null) { ctChapter.DataSource = chapterVerses; ctChapter.DataBind(); } return(1); }
public static void AddRange(this ControlCollection thisCollection, ControlCollection collection) { foreach (Control control in collection) { thisCollection.Add(control); } }
protected override void CreateFilterCtrl(Control NamingContainer, ControlCollection content) { if (_listItems != null) { _dpd = new HtmlCtrl.DropDownList("dpd" + ColName + "Filter") { Items = _listItems, SetLoad = OnLoad, SetSelectedIndexChanged = OnChanged } } ; else { _dpd = new HtmlCtrl.DropDownList("dpd" + ColName + "Filter") { DataSourceID = _DataSourceID, DataTextField = _DataTextField, DataValueField = _DataValueField, AppendDataBoundItems = true, Items = new ListItem[] { new ListItem(_AllSymbol, "-1") }, SetLoad = OnLoad, SetSelectedIndexChanged = OnChanged } }; content.Add(_dpd.ToWebControl()); }
public static void AddDiv(this ControlCollection controls, string text) { controls.Add(new HtmlGenericControl("div") { InnerHtml = text }); }
public static bool CheckHorseMove(int startX, int startY, int finishX, int finishY, bool[,] chessmanPresenceSign, ControlCollection controls, object sender, Dictionary <string, int> moveOrder) { //Общие правила хода var result = false; if (startX != finishX + 2 && startX != finishX - 2) { if (startX != finishX + 1 && startX != finishX - 1) { result = true; } else { if (startY != finishY + 2 && startY != finishY - 2) { result = true; } } } else { if (startY != finishY + 1 && startY != finishY - 1) { result = true; } } //Проверяем наличие шахматы в конечной ячейке if (result == false) { result = CheckFreeFinishCell(finishX, finishY, chessmanPresenceSign, controls, sender); } //Проверка атаки на короля-союзника result = CheckAllyKingBeAttacked(startX, startY, finishX, finishY, chessmanPresenceSign, controls, sender, result); //Проверка правильного удаления шахматы if (result && ((Chessman)sender).RemoveChessman) { controls.Add(TemporaryChassman); } ((Chessman)sender).RemoveChessman = false; //Проверка шаха и мата if (!result && !((Chessman)sender).FakeCheck) { CheckEnemyKingBeAttaced(startX, startY, finishX, finishY, chessmanPresenceSign, controls, sender, moveOrder); } return(result); }
/// <summary> /// Adds the prevalue controls. /// </summary> /// <param name = "collection">The collection.</param> /// <param name = "controls">The controls.</param> public static void AddPrevalueControls(this ControlCollection collection, params Control[] controls) { foreach (var control in controls) { collection.Add(control); } }
public static void HandleException(Exception ex, ControlCollection Controls) { Controls.Clear(); Controls.Add(new LiteralControl("<font style='color: red;'>Error: </font>" + ex.Message + "<br /><br />Share These Details with Support Staff:<br />" + parseException(ex))); }
public static void AddRange(this ControlCollection collection, IEnumerable <Control> items) { foreach (var control in items) { collection.Add(control); } }
private void AddButtonToCell(TableCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup) { WebControl child = null; ControlCollection controls = cell.Controls; if (this.ButtonType == ButtonColumnType.LinkButton) { LinkButton button = new DataGridLinkButton(); child = button; button.CommandName = commandName; button.Text = buttonText; button.CausesValidation = causesValidation; button.ValidationGroup = validationGroup; } else { Button button2 = new Button(); child = button2; button2.CommandName = commandName; button2.Text = buttonText; button2.CausesValidation = causesValidation; button2.ValidationGroup = validationGroup; } controls.Add(child); }
public void addRightCell(String str) { R_ListCell lc = new R_ListCell(str, lco); rightControl.Add(lc); handleMiddleCell(); }
private void RenderGotoPage(HtmlTextWriter writer, int totalPages) { WebControl webControl = new WebControl(HtmlTextWriterTag.Span); webControl.Attributes.Add("class", this.SkipPanelCssClass); ControlCollection controls = webControl.Controls; object arg = this.PageIndex; string arg2 = totalPages.ToString(CultureInfo.InvariantCulture); int num = this.TotalRecords; controls.Add(new LiteralControl($"第{arg}/{arg2}页 共{num.ToString(CultureInfo.InvariantCulture)}记录")); WebControl webControl2 = new WebControl(HtmlTextWriterTag.Input); webControl2.Attributes.Add("type", "text"); webControl2.Attributes.Add("class", this.SkipTxtCssClass); System.Web.UI.AttributeCollection attributes = webControl2.Attributes; num = this.PageIndex; attributes.Add("value", num.ToString(CultureInfo.InvariantCulture)); webControl2.Attributes.Add("size", "3"); webControl2.Attributes.Add("id", "txtGoto"); webControl.Controls.Add(webControl2); webControl.Controls.Add(new LiteralControl("页")); WebControl webControl3 = new WebControl(HtmlTextWriterTag.Input); webControl3.Attributes.Add("type", "button"); webControl3.Attributes.Add("class", this.SkipBtnCssClass); webControl3.Attributes.Add("value", "确定"); webControl3.Attributes.Add("onclick", $"location.href=AppendParameter('{this.PageIndexFormat}', $.trim($('#txtGoto').val()));"); webControl.Controls.Add(webControl3); webControl.RenderControl(writer); }
/// <summary> /// Gets or adds a <see cref="Control"/> to the <see cref="ControlCollection"/>. /// </summary> /// <typeparam name="TControl"></typeparam> /// <param name="controls"></param> /// <param name="predicate"></param> /// <param name="create"></param> /// <returns></returns> public static TControl GetOrAdd <TControl>(this ControlCollection controls, Predicate <TControl> predicate, Func <TControl> create) where TControl : Control { if (controls == null) { throw new ArgumentNullException(nameof(controls)); } if (predicate == null) { throw new ArgumentNullException(nameof(predicate)); } if (create == null) { throw new ArgumentNullException(nameof(create)); } // find existing var control = controls .OfType <TControl>() .Where(i => predicate(i)) .FirstOrDefault(); // add new if (control == null) { controls.Add(control = create()); } return(control); }
public void HtmlTableRowControlCollectionAdd_Null() { TestHtmlTable t = new TestHtmlTable(); ControlCollection c = t.GetCollection(); c.Add(null); }
public void HtmlTableRowControlCollectionAdd_WrongType() { TestHtmlTable t = new TestHtmlTable(); ControlCollection c = t.GetCollection(); c.Add(new HtmlTable()); }
/// <summary> /// Adds a specified control after another existing control in this collection. /// </summary> public static void AddAfter(this ControlCollection container, Control existingControl, Control newControl) { if (existingControl == null) { throw new ArgumentNullException("existingControl"); } if (newControl == null) { throw new ArgumentNullException("newControl"); } var index = container.IndexOf(existingControl); if (index == -1) { throw new ArgumentException(existingControl + " (" + existingControl.ID + ") does is not a child of this controls container."); } if (index == container.Count - 1) { container.Add(newControl); } else { container.AddAt(index + 1, newControl); } }
private void CargarMenu(ControlCollection items, DataView vItems, int nivel) { foreach (DataRowView rvItem in vItems) { HtmlGenericControl li = new HtmlGenericControl("li"); items.Add(li); HtmlAnchor anc = new HtmlAnchor(); li.Controls.Add(anc); anc.InnerText = rvItem["Etiqueta"].ToString(); if (Convert.ToInt32(rvItem["Tipo"]) == 2) { string rutas = rvItem["Ruta"].ToString(); string url = null; if (rutas.StartsWith("|")) { url = "~/" + rutas.Substring(1).Split("|".ToCharArray())[0]; } else { url = Convert.ToString("~/") + rutas; } anc.HRef = url; anc.Attributes["class"] = "seleccionable"; } DataView vHijos = new DataView(tMenu, "CodigoPadre='" + rvItem["Codigo"].ToString() + "'", "Orden", DataViewRowState.CurrentRows); if (vHijos.Count > 0) { HtmlGenericControl ul = new HtmlGenericControl("ul"); li.Controls.Add(ul); CargarMenu(ul.Controls, vHijos, nivel + 1); } } }
public static void GenerateRepeatControl(ControlCollection controls, string SystemInfo) { if (!string.IsNullOrEmpty(SystemInfo)) { SystemInfo = SystemInfo.Replace("PP", "P"); string[] RepeatFormStr = SystemInfo.Split('P'); if (RepeatFormStr.Length > 0) { controls.Clear(); foreach (String formStr in RepeatFormStr) { if (!string.IsNullOrEmpty(formStr)) { if (controls.Count != 0) { controls.Add(new LiteralControl(" , ")); } controls.Add(CommonUtility.GetPostbackURLForRepeatForm(formStr)); } } } } }
/// <summary> /// Find all controls with the given name in a collection /// </summary> /// <param name="name"></param> /// <param name="collection"></param> /// <returns></returns> private ControlCollection Find(string name, Control.ControlCollection collection) { ControlCollection results = new ControlCollection(); foreach (Control c in collection) { results.Add(Find(name, c)); // If the control is a ToolStripContainer we need to search in it's // panels for controls matching the name we serching for. if (c is ToolStripContainer) { ToolStripContainer container = (ToolStripContainer)c; results.Add(Find(name, container.TopToolStripPanel.Controls)); results.Add(Find(name, container.LeftToolStripPanel.Controls)); results.Add(Find(name, container.RightToolStripPanel.Controls)); results.Add(Find(name, container.BottomToolStripPanel.Controls)); results.Add(Find(name, container.ContentPanel.Controls)); } } return results; }
private ControlCollection Find(string name, Control control) { ControlCollection results = new ControlCollection(); if (Matches(name, control)) { results.Add(control); } results.Add(Find(name, control.Controls)); return results; }
private ControlCollection FindControls() { ControlCollection found = new ControlCollection(); foreach (Form form in FormCollection) { found.Add(Find(name, form)); } return found; }