当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.EndRenderText方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TreeNode.EndRenderText方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.EndRenderText方法的具体用法?C# TreeNode.EndRenderText怎么用?C# TreeNode.EndRenderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TreeNode的用法示例。


在下文中一共展示了TreeNode.EndRenderText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderNode


//.........这里部分代码省略.........
			// Node icon
			
			string imageUrl = node.ImageUrl;
			if (imageUrl == "" && imageStyle != null) {
				if (imageStyle.RootIcon != null && node.IsRootNode)
					imageUrl = GetNodeIconUrl (imageStyle.RootIcon);
				else if (imageStyle.ParentIcon != null && node.IsParentNode)
					imageUrl = GetNodeIconUrl (imageStyle.ParentIcon);
				else if (imageStyle.LeafIcon != null && node.IsLeafNode)
					imageUrl = GetNodeIconUrl (imageStyle.LeafIcon);
			}
			
			if (imageUrl != "") {
				writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
				BeginNodeTag (writer, node, clientExpand);
				writer.AddAttribute ("src", imageUrl);
				writer.AddAttribute ("border", "0");
				if (node.ImageToolTip != "") writer.AddAttribute ("alt", node.ImageToolTip);
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				writer.RenderEndTag ();	// IMG
				writer.RenderEndTag ();	// style tag
				writer.RenderEndTag ();	// TD
			}
			
			// Checkbox
			
			bool showChecks;
			if (node.IsShowCheckBoxSet)
				showChecks = node.ShowCheckBox;
			else
				showChecks = (ShowCheckBoxes == TreeNodeTypes.All) ||
							 (ShowCheckBoxes == TreeNodeTypes.Leaf && node.ChildNodes.Count == 0) ||
							 (ShowCheckBoxes == TreeNodeTypes.Parent && node.ChildNodes.Count > 0 && node.Parent != null) ||
							 (ShowCheckBoxes == TreeNodeTypes.Root && node.Parent == null && node.ChildNodes.Count > 0);

			if (showChecks) {
				AddNodeStyle (writer, node, level);
				writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
				writer.AddAttribute ("name", ClientID + "_cs_" + node.Path);
				writer.AddAttribute ("type", "checkbox");
				if (node.Checked) writer.AddAttribute ("checked", "checked");
				writer.RenderBeginTag (HtmlTextWriterTag.Input);	// INPUT
				writer.RenderEndTag ();	// INPUT
				writer.RenderEndTag ();	// TD
			}
			
			// Text
			
			if (!NodeWrap)
				writer.AddAttribute ("nowrap", "nowrap");
			writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
			
			node.BeginRenderText (writer);
			
			AddNodeStyle (writer, node, level);
			if (clientExpand)
				writer.AddAttribute ("id", GetNodeClientId (node, "txt"));
			BeginNodeTag (writer, node, clientExpand);
			writer.Write (node.Text);
			writer.RenderEndTag ();	// style tag
			
			node.EndRenderText (writer);
			
			writer.RenderEndTag ();	// TD
			
			writer.RenderEndTag ();	// TR
			writer.RenderEndTag ();	// TABLE
			
			// Children
			
			if (hasChildNodes)
			{
				if (level >= levelLines.Count) {
					if (hasNext) levelLines.Add (this);
					else levelLines.Add (null);
				} else {
					if (hasNext) levelLines [level] = this;
					else levelLines [level] = null;
				}
				
				if (clientExpand) {
					if (!node.Expanded) writer.AddStyleAttribute ("display", "none");
					else writer.AddStyleAttribute ("display", "block");
					writer.AddAttribute ("id", GetNodeClientId (node, null));
					writer.RenderBeginTag (HtmlTextWriterTag.Span);
					
					if (renderChildNodes) {
						int num = node.ChildNodes.Count;
						for (int n=0; n<num; n++)
							RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
					}
					writer.RenderEndTag ();	// SPAN
				}
				else if (renderChildNodes) {
					int num = node.ChildNodes.Count;
					for (int n=0; n<num; n++)
						RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
				}
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:101,代码来源:TreeView.cs

示例2: RenderNode


//.........这里部分代码省略.........

			if (!NodeWrap)
				writer.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");

			bool nodeIsSelected = node == SelectedNode && selectedNodeStyle != null;
			if (!nodeIsSelected && selectedNodeStyle != null) {
				if (!String.IsNullOrEmpty (activeSiteMapPath))
					nodeIsSelected = String.Compare (activeSiteMapPath, node.NavigateUrl, RuntimeHelpers.StringComparison) == 0;
			}
			
			AddNodeStyle (writer, node, level, nodeIsSelected);
			if (EnableClientScript) {
				writer.AddAttribute ("onmouseout", "TreeView_UnhoverNode(this)", false);
				writer.AddAttribute ("onmouseover", "TreeView_HoverNode('" + ClientID + "', this)");
			}
			writer.RenderBeginTag (HtmlTextWriterTag.Td);	// TD
			
			// Checkbox
			
			if (node.ShowCheckBoxInternal) {
				writer.AddAttribute (HtmlTextWriterAttribute.Name, ClientID + "_cs_" + node.Path);
				writer.AddAttribute (HtmlTextWriterAttribute.Type, "checkbox", false);
#if NET_4_0
				string str = node.ToolTip;
				if (!String.IsNullOrEmpty (str))
					writer.AddAttribute (HtmlTextWriterAttribute.Title, str);
#else
				writer.AddAttribute (HtmlTextWriterAttribute.Title, node.Text);
#endif
				if (node.Checked)
					writer.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
				writer.RenderBeginTag (HtmlTextWriterTag.Input);	// INPUT
				writer.RenderEndTag ();	// INPUT
			}
			
			// Text
			
			node.BeginRenderText (writer);
			
			if (clientExpand)
				writer.AddAttribute (HtmlTextWriterAttribute.Id, GetNodeClientId (node, "txt"));
			AddNodeLinkStyle (writer, node, level, nodeIsSelected);
			BeginNodeTag (writer, node, clientExpand);
			writer.Write (node.Text);
			writer.RenderEndTag ();	// style tag
			
			node.EndRenderText (writer);
			
			writer.RenderEndTag ();	// TD
			
			writer.RenderEndTag ();	// TR
#if !NET_4_0
			if (nodeSpacing != Unit.Empty)
				RenderMenuItemSpacing (writer, nodeSpacing);
#endif
			
			writer.RenderEndTag ();	// TABLE
			
			// Children
			
			if (hasChildNodes) {
				if (level >= levelLines.Count) {
					if (hasNext)
						levelLines.Add (this);
					else
						levelLines.Add (null);
				} else {
					if (hasNext)
						levelLines [level] = this;
					else
						levelLines [level] = null;
				}
				
				if (clientExpand) {
					if (!(node.Expanded.HasValue && node.Expanded.Value))
						writer.AddStyleAttribute (HtmlTextWriterStyle.Display, "none");
					else
						writer.AddStyleAttribute (HtmlTextWriterStyle.Display, "block");
					writer.AddAttribute (HtmlTextWriterAttribute.Id, GetNodeClientId (node, null));
					writer.RenderBeginTag (HtmlTextWriterTag.Span);
					
					if (renderChildNodes) {
						AddChildrenPadding (writer, node);
						int num = node.ChildNodes.Count;
						for (int n=0; n<num; n++)
							RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
						if (hasNext)
							AddChildrenPadding (writer, node);
					}
					writer.RenderEndTag ();	// SPAN
				} else if (renderChildNodes) {
					AddChildrenPadding (writer, node);
					int num = node.ChildNodes.Count;
					for (int n=0; n<num; n++)
						RenderNode (writer, node.ChildNodes [n], level + 1, levelLines, true, n<num-1);
					if (hasNext)
						AddChildrenPadding (writer, node);
				}
			}
		}
开发者ID:tgiphil,项目名称:mono,代码行数:101,代码来源:TreeView.cs


注:本文中的System.Web.UI.WebControls.TreeNode.EndRenderText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。