private void buscarHijos(string opcionPadreID, squishyTREE.TreeNode n)
        {
            IOpcion  opcion = OpcionFactory.GetOpcion();
            DsOpcion ds     = opcion.GetOpcionesHijos(opcionPadreID, Utiles.Validaciones.obtieneEntero(this.txtPerfilID.Text));
            int      i      = 2;

            foreach (DsOpcion.DatosRow dr in ds.Datos)
            {
                string key = "n" + i;
                // obtengo el nodo padre
                squishyTREE.TreeNode n1 = n.AddNode(dr.OpcionID, key, true);
                n1.AddTaggedValue("val1", dr.Descripcion);
                if (dr.Asignado)
                {
                    n1.Check();
                }
                // busco los hijos de este padre
                buscarHijos(dr.OpcionID, n1);
                i++;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handle the click of a node
        /// </summary>
        /// <param name="eventArgument"></param>
        public void RaisePostBackEvent(String eventArgument)
        {
            bool checkBoxClicked = false;

            if (eventArgument.IndexOf("checkbox") > -1)
            {
                eventArgument   = eventArgument.Replace(":checkbox", "");
                checkBoxClicked = true;
            }

            TreeNode selectedNode = (TreeNode)this.Page.FindControl(eventArgument);

            if (!checkBoxClicked)
            {
                selectedNode.IsExpanded = !selectedNode.IsExpanded;

                if (SelectedNodeChanged != null)
                {
                    SelectedNodeChanged(this, new TreeViewNodeClickEventArgs(selectedNode));
                }
            }
            else
            {
                //check the checkboxes
                selectedNode.Check();
                //force the parent to track its children's checked state. if any child in the
                //hierarchy is checked, then all the parents of this node need to also
                //be checked
                if (selectedNode.Parent is TreeNode)
                {
                    ((TreeNode)selectedNode.Parent).trackCheckedChildren();
                }
                //raise the event
                if (TreeNodeChecked != null)
                {
                    TreeNodeChecked(this, new TreeViewNodeClickEventArgs(selectedNode));
                }
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "asignarOpciones";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            tvwMain.AddHeader("Descripción", "", typeof(string), "val1", "left");
            if (!this.IsPostBack)
            {
                this.txtPerfilID.Text = this.Request.QueryString["PerfilID"] == null ? null : this.Request.QueryString["PerfilID"];

                ObtenerPerfil();

                IOpcion  opcion = OpcionFactory.GetOpcion();
                DsOpcion ds     = opcion.GetOpcionesPadres(Utiles.Validaciones.obtieneEntero(this.txtPerfilID.Text));
                foreach (DsOpcion.DatosRow dr in ds.Datos)
                {
                    // obtengo el nodo padre
                    tvwMain.ForceInheritedChecks = true;
                    squishyTREE.TreeNode n1 = tvwMain.AddNode(dr.OpcionID, "n1", true);
                    n1.AddTaggedValue("val1", dr.Descripcion);

                    if (dr.Asignado)
                    {
                        n1.Check();
                    }

                    // busco los hijos de este padre
                    buscarHijos(dr.OpcionID, n1);
                }
            }
        }