/// <summary> /// Removes the given split control from the panel's collection. /// </summary> public void Remove(SplitControl control) { int index = splitControls.IndexOf(control); splitControls.RemoveAt(index); if (splitControls.Count > 0) { for (int i = index; i < splitControls.Count; i++) { SplitControl toMove = (SplitControl)splitControls[i]; toMove.Location = toMove.Location.Subtract(spacing); toMove.Index = i + 1; } if (index == 0) { ((SplitControl)splitControls[index]).ToggleUp(false); } if (index == splitControls.Count) { ((SplitControl)splitControls.Last()).ToggleDown(false); } } UpdateCountLabel(); SaveSplits(false); }
/// <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); } }
public bool checkLeftNumRename(N_ListCell ncl, string text) { double num = 0; int index = leftNameControl.IndexOf(ncl); if (!double.TryParse(text, out num)) { return(false); } if (index != 0 && (leftNameControl[index - 1] as N_ListCell).getNum() > num) { return(false); } return(true); }
// Creates a new urlgeneratorcollection. Accepts the modules controls, ajaxmanager and control to position it to (usually null) public UrlGeneratorCollection(ControlCollection _controls, RadAjaxManager aManager, Control aControlPos) { // Creates a list of parameters controls _listOfControlObject = new List <ParameterControl>(); // Creates a button that generates the data url RadButton _urlGenerator = new RadButton(); _urlGenerator.Text = "Get data url"; _urlGenerator.ID = "STATIC_URLGENERATOR_BUTTON"; _urlGenerator.Click += FindUrl; // Generates url _urlGenerator.RenderMode = RenderMode.Lightweight; _urlGenerator.Style.Add("float", "right"); _urlGenerator.Icon.SecondaryIconCssClass = "rbSearch"; _urlGenerator.Icon.SecondaryIconRight = 5; // Create a new ajax setting AjaxSetting _buttonCtrl = new AjaxSetting(_urlGenerator.ID); // Fake label that the radwindow is added to _controlWindowHolder = new Label(); _controlWindowHolder.ID = "LABEL_WINDOWHOLDER"; // Add both the radbutton AjaxUpdatedControl _ctrlButton = new AjaxUpdatedControl(); _ctrlButton.ControlID = _urlGenerator.ID; _ctrlButton.UpdatePanelRenderMode = UpdatePanelRenderMode.Block; // And the label AjaxUpdatedControl _ctrl_Label = new AjaxUpdatedControl(); _ctrl_Label.ControlID = _controlWindowHolder.ID; _ctrl_Label.UpdatePanelRenderMode = UpdatePanelRenderMode.Block; // To the AjaxSetting _buttonCtrl.UpdatedControls.Add(_ctrlButton); _buttonCtrl.UpdatedControls.Add(_ctrl_Label); // Now add the ajaxsetting to the modules ajaxcontroller aManager.AjaxSettings.Add(_buttonCtrl); // Find the controls index in the control collection int _indexOfGrid = _controls.IndexOf(aControlPos); //If the control is found, anchor before it if (_indexOfGrid >= 0) { _controls.AddAt(_indexOfGrid, _controlWindowHolder); _controls.AddAt(_indexOfGrid, _urlGenerator); } else // if not, add to top { _controls.AddAt(0, _controlWindowHolder); _controls.AddAt(0, _urlGenerator); } }
public int Add(TableRow row) { if (row == null) { throw new NullReferenceException(); // .NET compatibility } if (row.TableRowSectionSet) { owner.GenerateTableSections = true; } row.Container = this; int index = cc.IndexOf(row); if (index < 0) { cc.Add(row); index = cc.Count; } return(index); }
public List <ListCell> findNeighborCell(MiddleCell mc) { int index = midControl.IndexOf(mc); List <ListCell> result = new List <ListCell>(); result.Add(leftNameControl.Cast <ListCell>().ToList().ElementAtOrDefault(index)); result.Add(leftControl.Cast <ListCell>().ToList().ElementAtOrDefault(index)); result.Add(rightControl.Cast <ListCell>().ToList().ElementAtOrDefault(index)); return(result); }
public static Control NextControl(this Control control) { ControlCollection siblings = control.Parent.Controls; for (int i = siblings.IndexOf(control) + 1; i < siblings.Count; i++) { if (siblings[i].GetType() != typeof(LiteralControl) && siblings[i].GetType().BaseType != typeof(LiteralControl)) { return(siblings[i]); } } return(null); }
public int Add(TableCell cell) { int index = cc.IndexOf(cell); if (index < 0) { cc.Add(cell); index = cc.Count; } return(index); }
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); }
protected virtual void OnCommand(object sender, CommandEventArgs e) { ButtonClickedHandler submitHandler = (ButtonClickedHandler)Events[_eventSubmitKey]; if (SelectionMode != SelectionModeType.Multiple) { foreach (ToolbarButton button in Items) { button.Selected = false; } } if (SelectionMode != SelectionModeType.Off) { int currentIndex = Controls.IndexOf((Control)sender); if (SelectionMode == SelectionModeType.Single) { Items[currentIndex].Selected = true; } else if (SelectionMode == SelectionModeType.Multiple) { // toggle selection Items[currentIndex].Selected = !Items[currentIndex].Selected; } if (Items[currentIndex].Selected) { LastSelectedIndex = currentIndex; } } if (submitHandler != null) { submitHandler(this, new ButtonEventArgs(e, _items[LastSelectedIndex])); } }
private void ClearReport() { ControlCollection coll = this.ReportViewer1.Parent.Controls; //remember the place, there the old ReportViewer was int oldIndex = coll.IndexOf(this.ReportViewer1); //remove in from the page coll.Remove(this.ReportViewer1); //then add new control ReportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer(); ReportViewer1.Height = Unit.Parse("490px"); ReportViewer1.Width = Unit.Parse("100%"); coll.AddAt(oldIndex, ReportViewer1); this.ReportViewer1.LocalReport.DataSources.Clear(); }
private void ConvertPersistedControlsToLiteralControls(Control defaultTemplateContents) { foreach (string str in this.PersistedControlIDs) { Control control = defaultTemplateContents.FindControl(str); if (control != null) { if (Array.IndexOf <string>(this.PersistedIfNotVisibleControlIDs, str) >= 0) { control.Visible = true; control.Parent.Visible = true; control.Parent.Parent.Visible = true; } if (control.Visible) { LiteralControl child = new LiteralControl(ControlPersister.PersistControl(control, this._designerHost)); ControlCollection controls = control.Parent.Controls; int index = controls.IndexOf(control); controls.Remove(control); controls.AddAt(index, child); } } } }
public int IndexOf(ReorderListItem item) { return(ChildList.IndexOf(item)); }
public int getCellIndex(R_ListCell rc) { return(rightControl.IndexOf(rc)); }
public int getCellIndex(L_ListCell lc) { return(leftControl.IndexOf(lc)); }
public int IndexOf(DigitViewer item) { return(controls.IndexOf(item)); }