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