private void btnGuardar_Click(object sender, System.EventArgs e) { i = 1; squishyTREE.TreeNode nodo = this.tvwMain.FindTreeNode("n1"); while (nodo != null) { // si esta seleccionado, lo agrego if (nodo.IsChecked) { //opciones.Add(nodo.Text); opciones.Add(nodo.Text, nodo.Text); obtenerHijosV2(nodo); } nodo = nodo.NextSibling(); } IPerfil perfil = PerfilFactory.GetPerfil(); perfil.PerfilID = Utiles.Validaciones.obtieneEntero(this.txtPerfilID.Text); try { perfil.AsignarOpciones(new ArrayList(opciones.Values)); Page.RegisterStartupScript("muestraMensaje", SisPackController.GenerarJavaScripts.MostrarMensaje("Los datos se guardaron correctamente.")); } catch (Exception ex) { ((ErrorWeb)phErrores.FindControl("Error")).setMensaje(ex.Message); } }
private void obtenerHijos(squishyTREE.TreeNode nodo) { string key = "n" + i; squishyTREE.TreeNode hijo; if (nodo != null) { //if (nodo.IsChecked) //opciones.Add(nodo.Text); hijo = nodo.FindTreeNode(key); } else { return; } // obtengo los hijos del nodo actual if (hijo != null) { //i++; obtenerHijos(hijo); } else { i++; obtenerHijos(nodo.NextSibling()); } }
public override void RenderImageLink(TreeNode node, HtmlTextWriter output) { int indent = node.Indent; //0-based StringBuilder sb = new StringBuilder(); while (indent > 0) //each indent level means one image { bool hasSibling, parentHasSibling, isTop; hasSibling = node.NextSibling() != null; isTop = node.Parent is TreeView; if (node.Parent is TreeNode) { parentHasSibling = ParentHasSibling(node, node.Indent - indent); } else { parentHasSibling = false; } if (node.Indent == indent) //first item in the indent { if (node.HasControls()) //there are children here { string anchorStart, anchorEnd; anchorStart = "<a href=\"" + this.TreeView.Page.GetPostBackClientHyperlink(this.TreeView, node.UniqueID) + "\">"; anchorEnd = "</a>"; if (hasSibling) //down dots { if (node.IsExpanded) //minus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topexpandedsibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middleexpandedsibling.gif' border='0'>" + anchorEnd); } } else //plus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topcollapsedsibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlecollapsedsibling.gif' border='0'>" + anchorEnd); } } } else //no down dots { if (node.IsExpanded) //minus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topexpandednosibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middleexpandednosibling.gif' border='0'>" + anchorEnd); } } else //plus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topcollapsednosibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlecollapsednosibling.gif' border='0'>" + anchorEnd); } } } } else // no children { if (hasSibling) { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlesiblingnochildren.gif' border='0'>"); } else { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "bottomnosiblingnochildren.gif' border='0'>"); } } } else // prior item in the indent { if (parentHasSibling) { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "vertbardots.gif' border='0'>"); } else { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "clear.gif' border='0'>"); } } indent--; } output.Write(sb.ToString()); }