DataBind() 공개 최종 메소드

public final DataBind ( ) : void
리턴 void
        public void Initialize()
        {
            BindCombos();
            BindPoliticas();

            //Microsoft.Web.UI.WebControls.TreeView tvw = (Microsoft.Web.UI.WebControls.TreeView)ES.Web.Global.FindMyControl(Page, "tvWorkflow");
            //tvw.Visible = true;
            //tvw.ExpandLevel = NIVELES_EXPANDIDOS;
            //NodeIndex = tvw.SelectedNodeIndex;

            //if(WorkflowId != -1)
            //{
            //    tvw.TreeNodeSrc = WFPolitica.ObtenerRepresentacionXml(WorkflowId);
            //    tvw.DataBind();
            //}

            System.Web.UI.WebControls.TreeView wft = (System.Web.UI.WebControls.TreeView)Web.Global.FindMyControl(Page, "wfTreeView");
            wft.Visible = true;
            wft.ExpandAll();
            //NodeIndex = wft.SelectedValue;

            if (WorkflowId != -1)
            {
                wft.DataSource = WFPolitica.ObtenerRepresentacionXmlDataSource(WorkflowId);

                // we want the full name displayed in the tree so
                // do custom databindings
                TreeNodeBinding Binding = new TreeNodeBinding();
                Binding.TextField  = "FullName";
                Binding.ValueField = "ID";
                wft.DataBindings.Add(Binding);

                wft.DataBind();

                //string xml = WFPolitica.ObtenerRepresentacionXml(WorkflowId);
                //XmlDocument XDoc = new XmlDocument();
                //XmlDeclaration XDec = XDoc.CreateXmlDeclaration("1.0", null, null);
                //XDoc.AppendChild(XDec);
                //XDoc.LoadXml(xml);
                ////string str = XDoc.OuterXml;

                //// we cannot bind the TreeView directly to an XmlDocument
                //// so we must create an XmlDataSource and assign the XML text
                //XmlDataSource XDdataSource = new XmlDataSource();
                //XDdataSource.ID = DateTime.Now.Ticks.ToString();  // unique ID is required
                //XDdataSource.Data = XDoc.OuterXml;

                //// we want the full name displayed in the tree so
                //// do custom databindings
                //TreeNodeBinding Binding = new TreeNodeBinding();
                //Binding.TextField = "Text";
                //Binding.ValueField = "NodeData";
                //wft.DataBindings.Add(Binding);

                //// Finally! Hook that bad boy up!
                //wft.DataSource = XDdataSource;
                //wft.DataBind();
            }
        }
		public void TreeView_MaxDataBindDepth () {
			TreeView tv = new TreeView ();
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.MaxDataBindDepth = 1;
			_TreeNodeDataBoundCount = 0;
			tv.TreeNodeDataBound += new TreeNodeEventHandler (TreeView_TreeNodeDataBound);
			Assert.AreEqual (0, tv.Nodes.Count, "BeforeDataBind1");
			tv.DataBind ();
			Assert.AreEqual (1, tv.Nodes.Count, "AfterDataBind1-a");
			Assert.AreEqual ("Book", tv.Nodes [0].Text, "AfterDataBind1-b");
			Assert.AreEqual (2, tv.Nodes [0].ChildNodes.Count, "AfterDataBind1-c");
			Assert.AreEqual (0, tv.Nodes [0].ChildNodes [0].ChildNodes.Count, "AfterDataBind1-d");
			Assert.AreEqual (3, _TreeNodeDataBoundCount, "AfterDataBind1-TreeNodeDataBoundCount");
		}
		public void TreeView_NullDS ()
		{
			TreeView tv = new TreeView ();
			tv.DataSource = null;
			tv.DataBind ();
			Assert.AreEqual (0, tv.Nodes.Count, "NullDS");
		}
		public static void PostBackFireEvents_3 (Page p)
		{
			TreeView tv = new TreeView ();
			tv.TreeNodeCollapsed += new TreeNodeEventHandler (tv_TreeNodeCollapsed);
			tv.TreeNodeExpanded +=new TreeNodeEventHandler(tv_TreeNodeExpanded);
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = true;
			tv.Nodes[0].ChildNodes[0].Selected = false;
			tv.Nodes[0].ChildNodes[0].Expanded = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = true;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.SelectExpand;
			p.Form.Controls.Add (tv);

			
		}
		public static void pageLoadNodeStates2 (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = false;
			tv.Nodes[0].ChildNodes[0].Selected = true;
			tv.Nodes[0].ChildNodes[0].Expanded = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = false;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.Expand;
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadNodeStrings (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].ToolTip = "string1";
			tv.Nodes[0].ImageToolTip = "string2";
			tv.Nodes[0].ChildNodes[0].ImageUrl = "string3";
			tv.Nodes[0].ChildNodes[0].NavigateUrl = "string4";
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].Target = "string5";
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].Text = "string6";
			tv.Nodes[0].ChildNodes[1].Value = "string7";
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
        protected void ibtnAgregar_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            int    Condicion = Int32.Parse(ddlCondicion.SelectedItem.Value);
            int    Tipo      = Int32.Parse(ddlTipo.SelectedItem.Value);
            string Valor     = txtPolitica.Text;
            Label  lblError  = (Label)Global.FindMyControl(Page, "lblError");

            if (Condicion == 0 || Tipo == 0 || Valor == "")
            {
                lblError.Visible = true;
                lblError.Text    = ESMensajes.ObtenerMensaje(551);
                return;
            }
            else
            {
                lblError.Visible = false;
            }

            WFCondicion  objCondicion = WFCondicion.ObtenerCondicionPorID(Condicion);
            WFTipoDeDato objTipo      = WFTipoDeDato.ObtenerTiposDeDatoPorID(Tipo);

            //Microsoft.Web.UI.WebControls.TreeView tvw = (Microsoft.Web.UI.WebControls.TreeView)Page.FindControl("tvWorkflow");
            System.Web.UI.WebControls.TreeView tvw = (System.Web.UI.WebControls.TreeView)Web.Global.FindMyControl(Page, "wfTreeView");

            System.Web.UI.WebControls.TreeNode tn = Global.GetNodeFromPath(tvw.Nodes, NodeIndex);
            if (tn == null || tn.ChildNodes.Count > 0)
            {
                return;                                        //MOSTRAR ALGUN MENSAJE DE ALARMA: no se puede indexar más de una política dentro de otra
            }
            int        ID          = Convert.ToInt32(tn.Value);
            WFPolitica newPolitica = new WFPolitica(WorkflowId, 0, ID, objCondicion, Valor, objTipo);

            if (newPolitica.Save())
            {
                ddlCondicion.SelectedIndex = 0;
                ddlTipo.SelectedIndex      = 0;
                txtPolitica.Text           = "";
                BindPoliticas();

                tvw.DataSource = WFPolitica.ObtenerRepresentacionXmlDataSource(WorkflowId);
                tvw.DataBind();
                HiddenField nodeIndex = (HiddenField)Global.FindMyControl(Page, "NodeIndex");
                nodeIndex.Value  = "0";
                lblError.Visible = false;
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = ESMensajes.ObtenerMensaje(302);
            }

            //Microsoft.Web.UI.WebControls.TreeNode tn = tvw.GetNodeFromIndex(NodeIndex);
            //int ID = 0;
            //if(tn.NodeData != "") ID = Convert.ToInt32(tn.NodeData);

            //WFPolitica newPolitica = new WFPolitica(WorkflowId, 0, ID, objCondicion, Valor, objTipo);
            //if (newPolitica.Save())
            //{
            //    ddlCondicion.SelectedIndex = 0;
            //    ddlTipo.SelectedIndex = 0;
            //    txtPolitica.Text = "";
            //    BindPoliticas();

            //    tvw.TreeNodeSrc = WFPolitica.ObtenerRepresentacionXml(WorkflowId);
            //    tvw.DataBind();
            //    lblError.Visible = false;
            //}
            //else
            //{
            //    lblError.Visible = true;
            //    lblError.Text = ESMensajes.ObtenerMensaje(302);
            //}
        }
		public static void pageLoadNodeExpandAll (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.CollapseAll ();
			tv.Nodes[0].ChildNodes[0].ExpandAll ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadImagesOn (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.CollapseImageToolTip = "Test111";
			tv.ExpandImageToolTip = "Test222";
			tv.CollapseImageUrl = "Test333";
			tv.ExpandImageUrl = "Test444";
			tv.NoExpandImageUrl = "Test555";
			tv.LineImagesFolder = "Test666";
			tv.ShowLines = true;
			tv.ShowExpandCollapse = true;
			tv.ImageSet = TreeViewImageSet.Custom;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadValues (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.ImageSet = TreeViewImageSet.Arrows;
			tv.SkipLinkText = "mySkipLinkText";
			tv.NodeIndent = 30;
			tv.ExpandDepth = 3;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadBindings (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.ImageSet = TreeViewImageSet.Arrows;
			tv.AutoGenerateDataBindings = false;
			tv.MaxDataBindDepth = 1;
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[0].DataMember = "Book";
			tv.DataBindings[0].TextField = "Title";
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[1].DataMember = "Chapter";
			tv.DataBindings[1].TextField = "Heading";
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[2].DataMember = "Section";
			tv.DataBindings[2].TextField = "Heading";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
예제 #12
0
파일: BrandList.aspx.cs 프로젝트: eavia/tts
 private void ExplandTreeNode(TreeView tr)
 {
     TreeNode root = tr.SelectedNode;
     if (root != null)
     {
         int rid = int.Parse(root.Value);
         var cs = logic.GetChildren(rid);
         if (cs.Count() != 0)
         {
             root.ChildNodes.Clear();
             foreach (Brand b in cs.First().ChildBrandSet)
             {
                 TreeNode node = new TreeNode();
                 node.Text = b.BrandName;
                 node.Value = b.ID.ToString();
                 root.ChildNodes.Add(node);
             }
         }
         else
         {
             root.ChildNodes.Clear();
             cs = logic.GetRootBrand();
             foreach (Brand b in cs)
             {
                 TreeNode node = new TreeNode();
                 node.Text = b.BrandName;
                 node.Value = b.ID.ToString();
                 root.ChildNodes.Add(node);
             }
         }
         tr.DataBind();
     }
 }
예제 #13
0
파일: BrandList.aspx.cs 프로젝트: eavia/tts
 private void BuildRootNode(TreeView tr)
 {
     tr.Nodes.Clear();
     TreeNode node = new TreeNode();
     node.Text = "根目录";
     node.Value = "0";
     tr.Nodes.Add(node);
     tr.DataBind();
 }
예제 #14
0
		public static void pageLoadRender (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			TreeNode tn = new TreeNode
				("text", "value", "imageUrl", "navigateUrl", "target");
			tn.Checked = true;
			tn.ChildNodes.Add (new TreeNode ("childenode"));
			tn.Expanded = true;
			tn.ImageToolTip = "ImageToolTip";
			tn.PopulateOnDemand = false;
			tn.SelectAction = TreeNodeSelectAction.SelectExpand;
			tn.Selected = true;
			tn.ShowCheckBox = true;
			tn.ToolTip = "ToolTip";
			tv.Nodes.Add (tn);
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadRenderDefaults (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadRenderLevelStyleCssClass (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";

			TreeNodeStyle tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass1";
			tv.LevelStyles.Add (tns);
			
			tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass2";
			tv.LevelStyles.Add (tns);

			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadWrapOff (Page page) {
			TreeView tv = new TreeView ();
			tv.ID = "treeview1";
			tv.NodeWrap = false;
			tv.Nodes.Add (new TreeNode ("TreeNode1"));
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
        public void Initialize()
        {
            lstNiveles.Items.Clear();
            lstEscogencia.Items.Clear();

            System.Web.UI.WebControls.TreeView wft = (System.Web.UI.WebControls.TreeView)Web.Global.FindMyControl(Page, "wfTreeView");
            wft.Visible = true;
            wft.ExpandAll();
            //NodeIndex = wft.SelectedValue;

            if (WorkflowId != -1 && FirstTime)
            {
                FirstTime      = false;
                wft.DataSource = WFPolitica.ObtenerRepresentacionXmlDataSourceConRutas(WorkflowId);

                // we want the full name displayed in the tree so
                // do custom databindings
                TreeNodeBinding Binding = new TreeNodeBinding();
                Binding.TextField  = "FullName";
                Binding.ValueField = "ID";
                wft.DataBindings.Add(Binding);

                wft.DataBind();
            }

            System.Web.UI.WebControls.TreeNode tn = Global.GetNodeFromPath(wft.Nodes, NodeIndex);
            if (tn == null || tn.ChildNodes.Count > 1)
            {
                return;                                        //MOSTRAR ALGUN MENSAJE DE ALARMA: no es una hoja donde se pueda conseguir una ruta
            }
            int ID = 0;

            if (tn.Value[0] == 'R')
            {
                ID = Convert.ToInt32(tn.Value.Substring(2));

                //lstNiveles.DataSource = WFGrupoDeRoles.ObtenerGruposDeRolesExcepto(ID);
                lstNiveles.DataSource     = WFGrupoDeRoles.ObtenerGruposDeRolesExcepto(0);
                lstNiveles.DataTextField  = "strNbrRoles";
                lstNiveles.DataValueField = "intCodRoles";
                lstNiveles.DataBind();

                lstEscogencia.DataSource     = WFGrupoDeRoles.ObtenerGruposDeRoles(ID, tn.Text);
                lstEscogencia.DataTextField  = "strNbrRoles";
                lstEscogencia.DataValueField = "intCodRoles";
                lstEscogencia.DataBind();
            }
            else
            {
                lstNiveles.DataSource     = WFGrupoDeRoles.ObtenerGruposDeRolesExcepto(ID);
                lstNiveles.DataTextField  = "strNbrRoles";
                lstNiveles.DataValueField = "intCodRoles";
                lstNiveles.DataBind();
            }

            /*
             * Microsoft.Web.UI.WebControls.TreeView tvw = (Microsoft.Web.UI.WebControls.TreeView)Page.FindControl("tvWorkflow");
             *          if(WorkflowId != -1 && FirstTime)
             *          {
             *                  FirstTime = false;
             *                  tvw.TreeNodeSrc = WFPolitica.ObtenerRepresentacionXmlConRutas(WorkflowId);
             *                  tvw.DataBind();
             *          }
             *
             *          tvw.Visible = true;
             *          tvw.AutoPostBack = true;
             *          tvw.ExpandLevel = NIVELES_EXPANDIDOS;
             *
             *          NodeIndex = tvw.SelectedNodeIndex;
             *          Microsoft.Web.UI.WebControls.TreeNode tn = tvw.GetNodeFromIndex(NodeIndex);
             *          int ID = 0;
             *          if(tn != null)
             *          {
             *                  if(tn.NodeData[0] != 'N')
             *                  {
             *                          ID = Convert.ToInt32(tn.NodeData);
             *
             *                          lstNiveles.DataSource = WFGrupoDeRoles.ObtenerGruposDeRolesExcepto(ID);
             *                          lstNiveles.DataTextField = "strNbrRoles";
             *                          lstNiveles.DataValueField = "intCodRoles";
             *                          lstNiveles.DataBind();
             *
             *                          lstEscogencia.DataSource = WFGrupoDeRoles.ObtenerGruposDeRoles(ID,tn.Text);
             *                          lstEscogencia.DataTextField = "strNbrRoles";
             *                          lstEscogencia.DataValueField = "intCodRoles";
             *                          lstEscogencia.DataBind();
             *                  }
             *                  else
             *                  {
             *                          lstNiveles.DataSource = WFGrupoDeRoles.ObtenerGruposDeRolesExcepto(ID);
             *                          lstNiveles.DataTextField = "strNbrRoles";
             *                          lstNiveles.DataValueField = "intCodRoles";
             *                          lstNiveles.DataBind();
             *                  }
             *          }*/
        }
		public static void pageLoadInvisible (Page page) {
			TreeView tv = new TreeView ();
			tv.ID = "treeview1";
			tv.Visible = false;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBindSmall;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}