private bool RenderHeader(HtmlTextWriter output) { if (Selected && BaseTree.SelectionType == SelectionType.Single) { output.Write("<script language=\"javascript\">\n"); output.Write("function ATV_create_{0}(e)\n", ClientID); output.Write("{\n"); output.Write("selectNode('{0}','{1}');", BaseTree.ClientID, ClientID); output.Write("}\n"); output.Write("window.RegisterEvent(\"onload\", ATV_create_{0});\n", ClientID); output.Write("\n</script>\n"); } output.AddAttribute(HtmlTextWriterAttribute.Type, "Hidden"); output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); output.AddAttribute(HtmlTextWriterAttribute.Value, DateTime.Now.Ticks.ToString()); output.RenderBeginTag(HtmlTextWriterTag.Input); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); output.AddAttribute(HtmlTextWriterAttribute.Value, Expanded.ToString()); output.RenderBeginTag(HtmlTextWriterTag.Input); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_expanded"); output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "_expanded"); output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); output.AddAttribute(HtmlTextWriterAttribute.Value, Expanded.ToString()); output.RenderBeginTag(HtmlTextWriterTag.Input); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); output.AddAttribute(HtmlTextWriterAttribute.Border, "0"); NodeStyle.AddAttributesToRender(output); output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_table"); output.RenderBeginTag(HtmlTextWriterTag.Table); // Open Table var singleOk = false; if (Click == null && BaseTree.UseSameClickEvent && BaseTree.Click == null && (_link == null || _link == string.Empty && Enabled) && Nodes.Count > 0 && BaseTree.SelectionType != SelectionType.CheckBox) { if (BaseTree.SelectionType != SelectionType.Single) { output.AddAttribute(HtmlTextWriterAttribute.Onclick, BaseTree.LoadOnDemand ? $"javascript:loadNode(\'{BaseTree.ClientID}\', \'{ID}\', \'{ClientID}\', \'{BaseTree.ClientID}\', \'{BaseTree.Path}\');" : $"javascript:toggleNode(\'{ClientID}\', \'{BaseTree.ClientID}\');"); } else { singleOk = true; } } return(singleOk); }
public XmlNode GenerateXML() { // Create XML Node and Attributes XmlDocument d = new XmlDocument(); XmlNode output = d.CreateNode("element", "Action", null); XmlAttribute type = d.CreateAttribute("Type"); XmlAttribute applicationVariableBase = d.CreateAttribute("ApplicationVariableBase"); XmlAttribute packageVariableBase = d.CreateAttribute("PackageVariableBase"); XmlAttribute showBack = d.CreateAttribute("ShowBack"); XmlAttribute showCancel = d.CreateAttribute("ShowCancel"); XmlAttribute title = d.CreateAttribute("Title"); XmlAttribute size = d.CreateAttribute("Size"); XmlAttribute expanded = d.CreateAttribute("Expanded"); XmlAttribute centerTitle = d.CreateAttribute("CenterTitle"); XmlAttribute condition = d.CreateAttribute("Condition"); // Assign attribute values type.Value = "AppTree"; applicationVariableBase.Value = ApplicationVariableBase; packageVariableBase.Value = PackageVariableBase; showBack.Value = ShowBack.ToString(); showCancel.Value = ShowCancel.ToString(); title.Value = Title; size.Value = Size; expanded.Value = Expanded.ToString(); centerTitle.Value = CenterTitle.ToString(); condition.Value = Condition; // Append Attributes output.Attributes.Append(type); if (!string.IsNullOrEmpty(ApplicationVariableBase)) { output.Attributes.Append(applicationVariableBase); } if (!string.IsNullOrEmpty(PackageVariableBase)) { output.Attributes.Append(packageVariableBase); } if (null != ShowBack) { output.Attributes.Append(showBack); } if (null != ShowCancel) { output.Attributes.Append(showCancel); } if (!string.IsNullOrEmpty(Title)) { output.Attributes.Append(title); } if (!string.IsNullOrEmpty(Size)) { output.Attributes.Append(size); } if (null != Expanded) { output.Attributes.Append(expanded); } if (!string.IsNullOrEmpty(Condition)) { output.Attributes.Append(condition); } output.Attributes.Append(centerTitle); // Add all child nodes to the group XmlNode SoftwareSetsNode = d.CreateNode("element", "SoftwareSets", ""); foreach (IElement sets in SubChildren) { XmlNode importNode = d.ImportNode(sets.GenerateXML(), true); SoftwareSetsNode.AppendChild(importNode); } output.AppendChild(SoftwareSetsNode); return(output); }
/// <summary> /// Renders the node for uplevel browsers. /// </summary> /// <param name="output">The HtmlTextWriter object that receives the content.</param> protected override void RenderUpLevelPath(HtmlTextWriter output) { if (Type != String.Empty) { output.AddAttribute("Type", Type); } if (Expandable == ExpandableValue.CheckOnce) { output.AddAttribute("Expandable", "checkOnce"); } else if (Expandable == ExpandableValue.Always) { output.AddAttribute("Expandable", "always"); } if (CheckedExpandable) { output.AddAttribute("checkedExpandable", "true"); } // Because of ExpandLevel, we need to distinguish between explicitly-declared false and default false. // Only the explicit false will be stored in ViewState. object b = ViewState["Expanded"]; if (Expanded || (b != null && (bool)b == false)) { output.AddAttribute("Expanded", Expanded.ToString()); } if (Selected) { output.AddAttribute("Selected", "true"); } if (NavigateUrl != String.Empty) { output.AddAttribute("NavigateUrl", NavigateUrl); } if (Checked) { output.AddAttribute("Checked", "true"); } if (NodeData != String.Empty) { output.AddAttribute("NodeData", NodeData); } AddAttributesToRender(output); output.RenderBeginTag("tvns:treenode"); if (Text != String.Empty) { output.Write(Text); } base.RenderUpLevelPath(output); // Render contained nodes foreach (TreeNode node in Nodes) { node.Render(output, RenderPathID.UpLevelPath); } output.RenderEndTag(); }