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


C# PlaceHolder.Dispose方法代码示例

本文整理汇总了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));
            }
        }
开发者ID:nschonni,项目名称:wet-boew-sharepoint,代码行数:84,代码来源:LeftNavigation.cs


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