/// <summary> /// /// </summary> /// <param name="index">The index of the item being inserted.</param> /// <param name="value">The item being inserted.</param> protected override void OnInsertComplete(int index, object value) { base.OnInsertComplete(index, value); if (!Reloading) { TreeView tv; if (Parent is TreeNode) { tv = ((TreeNode)Parent).ParentTreeView; } else { tv = (TreeView)Parent; } if ((tv != null) && tv.IsInitialized) { if (_tnSelected != null) { tv.SelectedNodeIndex = _tnSelected.GetNodeIndex(); } else { tv.SelectedNodeIndex = "0"; } } } }
private void CaricaDatiRicerca(string idFascicolo, string idFolderSel) { ClearTreeView(); fascicoloSelezionato = FascicoliManager.getFascicoloById(this, idFascicolo); FascicoliManager.setFascicoloSelezionato(this, fascicoloSelezionato); Folder folder = FascicoliManager.getFolder(this, fascicoloSelezionato.systemID, ""); Microsoft.Web.UI.WebControls.TreeNode rootFolder = new Microsoft.Web.UI.WebControls.TreeNode(); //Creo la root folder dell'albero rootFolder.Text = fascicoloSelezionato.codice; rootFolder.ID = fascicoloSelezionato.systemID; if (folder.childs.Length > 0) { LoadTreeview(rootFolder, folder, idFolderSel); } Folders.Nodes.Add(rootFolder); Microsoft.Web.UI.WebControls.TreeNode nodoSel = getSelectedNodeFolder(); if (nodoSel != null) { Folders.SelectedNodeIndex = nodoSel.GetNodeIndex(); } }
/// <summary> /// /// </summary> /// <param name="index">The index of the item being removed.</param> /// <param name="value">The item being removed.</param> protected override void OnRemove(int index, object value) { if (!Reloading) { TreeNode node = (TreeNode)value; TreeView tv = node.ParentTreeView; if (tv != null) { if (tv.SelectedNodeIndex.IndexOf(node.GetNodeIndex()) == 0) { // The node being removed is the selected node or one of its parents TreeNode newNode = null; if (Count > 1) { // Set the new selected node index to the next node // or the previous one if the node is the last node if (index == (Count - 1)) { newNode = this[index - 1]; } else { newNode = this[index + 1]; } } else if ((Parent != null) && (Parent is TreeNode)) { // There are no other nodes in this collection, so // try setting to its parent newNode = (TreeNode)Parent; } _tnSelected = newNode; } else { // The selected node does not need to change, but its // index may be affected by this removal. _tnSelected = tv.GetNodeFromIndex(tv.SelectedNodeIndex); } } } base.OnRemove(index, value); }
private bool cerca(string idFolderSel, Microsoft.Web.UI.WebControls.TreeNode node) { bool retValue = false; if (node.ID == idFolderSel) { this.Folders.SelectedNodeIndex = node.GetNodeIndex(); retValue = true; } else { foreach (Microsoft.Web.UI.WebControls.TreeNode child in node.Nodes) { retValue = (this.cerca(idFolderSel, child)); if (retValue) { break; } } } return(retValue); }
private void BindData() { string F = Request.QueryString["File"]; if (F != null && F != "") { ListItem li = ddlFormulaFile.Items.FindByText(F); if (li != null) { foreach (ListItem l in ddlFormulaFile.Items) { l.Selected = false; } li.Selected = true; } } string FileName = Config.PluginsDirectory + ddlFormulaFile.SelectedItem.Value; FormulaSpace fs = FormulaSpace.Read(FileName); string Id = Request.Params["Id"]; if (Id == null || Id == "") { CurrentId = -1; } else { CurrentId = int.Parse(Id); } LoadToTree(fs); if (CurrentProgram == null) { Msft.TreeNode t = FormulaTree.Nodes[0]; while (t.Nodes.Count > 0) { t.Expanded = true; t = t.Nodes[0]; } tdChart.Visible = false; } else { for (object o = CurrentNode; !(o is Msft.TreeView); o = ((Msft.TreeNode)o).Parent) { ((Msft.TreeNode)o).Expanded = true; } FormulaTree.SelectedNodeIndex = CurrentNode.GetNodeIndex(); lParam.Text = "<table border=1><tr><td>Name</td><td>Default Value</td><td>Minimum Value</td><td>Maxmum Value</td></tr>"; foreach (FormulaParam fpm in CurrentProgram.Params) { lParam.Text += "<tr><td>"; lParam.Text += fpm.Name + "</td><td>"; string Value = fpm.DefaultValue; string r = "__Param" + fpm.Name; if (Request.Form[r] != null && Request.Form[r] != "") { Value = Request.Form[r]; } lParam.Text += "<input Name=" + r + " value=" + Value + "></td><td>"; lParam.Text += fpm.MinValue + "</td><td>"; lParam.Text += fpm.MaxValue + "</td></tr>"; } lParam.Text += "</table><br>"; lName.Text = CurrentProgram.Name; lFullName.Text = CurrentProgram.FullName; lDescription.Text = "<br>" + CurrentProgram.Description.Replace("\n", "<br>"); lCode.Text = "<br>" + ReplaceMethodWithColor( ReplaceMethodWithColor(Server.HtmlEncode(CurrentProgram.Code), "#008000", CurrentProgram.Params.GetParamList(), false) ).Replace("\n", "<br>"); lMainView.Visible = CurrentProgram.IsMainView; } }