protected override void Render(HtmlTextWriter writer) { IEnumerator myEnumerator = myControlCollection.GetEnumerator(); Button tempButton = new Button(); writer.Write("<br><br><b> CustomLiteralControlClass has child controls = </b>" + this.HasControls()); while (myEnumerator.MoveNext()) { object myObject = myEnumerator.Current; if (myObject.GetType().Equals(typeof(Button))) { Button childControlButton = (Button)myEnumerator.Current; writer.Write("<br><br><b> This is the text of the child Control :</b>" + childControlButton.Text + "<br>"); } } string builder = "<h3>"; for (int i = 0; i < _text.Length; i++) { string currentChar = _text.Substring(i, 1); if (i % 2 == 0) { builder += "<font color=red>" + currentChar + "</font>"; } else { builder += "<font color=blue>" + currentChar + "</font>"; } } builder += "</h3>"; writer.Write(builder); }
private IList <string> GetDeeper(Control container) { List <string> result = new List <string>(); if (container != null) { ControlCollection coll = container.Controls; IEnumerator it = coll.GetEnumerator(); while (it.MoveNext()) { Control control = (Control)it.Current; if (control is IDocbaseControl) { string id = ((IDocbaseControl)control).getObjectId(); if (id != null) { result.Add(id); } } else { result.AddRange(GetDeeper(control)); } } } return(result); }
public void Deny_Unrestricted() { // note: using the same control (as owner) to add results // in killing the ms runtime with a stackoverflow - FDBK36722 ControlCollection cc = new ControlCollection(new Control()); Assert.AreEqual(0, cc.Count, "Count"); Assert.IsFalse(cc.IsReadOnly, "IsReadOnly"); Assert.IsFalse(cc.IsSynchronized, "IsSynchronized"); Assert.IsNotNull(cc.SyncRoot, "SyncRoot"); cc.Add(control); Assert.IsNotNull(cc[0], "this[int]"); cc.Clear(); cc.AddAt(0, control); Assert.IsTrue(cc.Contains(control), "Contains"); cc.CopyTo(new Control[1], 0); Assert.IsNotNull(cc.GetEnumerator(), "GetEnumerator"); Assert.AreEqual(0, cc.IndexOf(control), "IndexOf"); cc.RemoveAt(0); cc.Remove(control); }
private void seeDeeper(Control container, string type) { if (container == null) { return; } ControlCollection coll = container.Controls; IEnumerator it = coll.GetEnumerator(); while (it.MoveNext()) { Control control = (Control)it.Current; if (control == null) { break; } else if (control is IDocbaseControl) { ((IDocbaseControl)control).saveObject(hospitalSession, parentId, parentType); string id = ((IDocbaseControl)control).getObjectId(); IDdtRelationService relationService = DbDataService.GetInstance().GetDdtRelationService(); if (id != null && parentId != null && parentType != null && relationService.GetByParentAndChildIds(parentId, id) == null) { DdtRelation relation = new DdtRelation(); relation.Parent = parentId; relation.Child = id; relation.ChildType = type; relationService.Save(relation); } } else { seeDeeper(control, type); } } }
public IEnumerator GetEnumerator() { return(cc.GetEnumerator()); }
public IEnumerator <DigitViewer> GetEnumerator() { return(controls.GetEnumerator() as IEnumerator <DigitViewer>); }