本文整理汇总了C#中System.Web.UI.WebControls.PlaceHolder.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PlaceHolder.Dispose方法的具体用法?C# PlaceHolder.Dispose怎么用?C# PlaceHolder.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.PlaceHolder
的用法示例。
在下文中一共展示了PlaceHolder.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderNode
private void RenderNode(PlaceHolder placeHolder, SiteMapNode node, int level)
{
//<section>
// <h3><a href="#" class="nav-current">Current section (4) example </a></h3>
// <ul>
// <li><a href="#">Item 4a</a></li>
// <li><a href="#" class="nav-current">Current item (4b) example</a>
// <ul>
// <li><a href="#">Item 4bi</a></li>
// <li><a href="#" class="nav-current">Current sub (4bii) item example</a></li>
// <li><a href="#">Item 4biii</a></li>
// </ul>
// </li>
// <li><a href="#">Item 4c</a></li>
// </ul>
//</section>
if (!ShowNode(node, level))
{
return;
}
string cssClass = GetCssClass(node, level);
String cssClassHtml = String.Empty;
if (!String.IsNullOrEmpty(cssClass))
{
cssClassHtml = String.Format(" class=\"{0}\"", cssClass);
}
// figure out the wrapper that you want to put around the Node depending on the level
// handle the section headers
if (level == 0)
{
// add the "<section><h3>"
placeHolder.Controls.Add(new LiteralControl(SectionOpenHTML + SectionHeaderOpenHtml));
}
else
{
// render a "<LI>" for the item
placeHolder.Controls.Add(new LiteralControl(String.Format(ListItemOpenHtml, cssClassHtml)));
}
// Render the link for the item or title
RenderNodeItem(placeHolder, node, cssClass);
// render any closing elements for the level
if (level == 0)
{
placeHolder.Controls.Add(new LiteralControl(SectionHeaderCloseHtml));
}
// render any expandable child items
if (IsNodeExpandable(node, level))
{
SiteMapNodeCollection nodes = _provider.GetChildNodes(node);
PlaceHolder childrenPlaceHolder = new PlaceHolder();
foreach (SiteMapNode childrenNode in nodes)
{
RenderNode(childrenPlaceHolder, childrenNode, level + 1);
}
if (childrenPlaceHolder.Controls.Count > 0)
{
String subListCssClass = String.Empty;
placeHolder.Controls.Add(new LiteralControl(ListOpenHtml));
placeHolder.Controls.Add(childrenPlaceHolder);
placeHolder.Controls.Add(new LiteralControl(ListCloseHtml));
}
else
{
childrenPlaceHolder.Dispose();
}
}
// render any closing elements for the 0 level section or the child list item
if (level == 0)
{
placeHolder.Controls.Add(new LiteralControl(SectionCloseHTML));
}
else
{
placeHolder.Controls.Add(new LiteralControl(ListItemCloseHtml));
}
}