本文整理匯總了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));
}
}