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


C# SPWeb.GetSubwebsForCurrentUser方法代码示例

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


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

示例1: ShowSubwebs

        private void ShowSubwebs(SPWeb spWeb, System.Web.UI.HtmlTextWriter writer)
        {
            //��ʾ�Ƕ���վ��quickLaunch
            SPNavigationNodeCollection nodes = spWeb.Navigation.UseShared ? null : spWeb.Navigation.TopNavigationBar;

            int temp = 1;
            if ((nodes != null) && (nodes.Count > 0))
            {
                foreach (SPNavigationNode childNode in nodes)
                {
                    string divId = this.ClientID.Replace("_","").ToString() + temp;//�ڶ���Ŀ¼div��Ӧid

                    if (childNode.Title != "Home")
                        CreateLevelOne(childNode, writer, divId);
                    else
                        continue;
                    //QuickLaunch
                    if (System.Web.HttpContext.Current.Request.Cookies[divId] != null && System.Web.HttpContext.Current.Request.Cookies[divId].Value == divId)
                        writer.WriteLine("<div id='" + divId + "' style='display:block;'>");
                    else
                        writer.WriteLine("<div id='" + divId + "' style='display:none;'>");

                    foreach (SPWeb web in spWeb.GetSubwebsForCurrentUser())
                    {
                        if (web.Url.EndsWith(childNode.Url) && web.Title == childNode.Title)
                        {
                            SPNavigationNodeCollection quickLaunchList = web.Navigation.QuickLaunch;
                            if ((quickLaunchList != null) && (quickLaunchList.Count > 0))
                            {

                                writer.WriteLine("<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' class='nav-sub-table'>");
                                foreach (SPNavigationNode node in quickLaunchList)
                                {
                                    foreach (SPNavigationNode node2 in node.Children)
                                    {
                                        writer.WriteLine("<tr><td width='20%'>&nbsp;</td>");
                                        writer.WriteLine("<td width='10%' class='nav-sub-center'>&nbsp;</td>");
                                        writer.WriteLine("<td align='left' NOWRAP>&nbsp;<a class='nav-sub-right' href=\"" + node2.Url + "\">" + node2.Title + "</a></td>");
                                        writer.WriteLine("</tr>");
                                    }
                                }
                                writer.WriteLine("</table>");
                            }
                        }
                        web.Dispose();
                    }

                    temp++;

                    writer.WriteLine("</div>");

                }
            }
        }
开发者ID:porter1130,项目名称:C-A,代码行数:54,代码来源:SiteNavigation.cs

示例2: ShowSubwebs

 private void ShowSubwebs(SPWeb spWeb, System.Web.UI.HtmlTextWriter writer)
 {
     //��ʾ�Ƕ���վ��quickLaunch
     SPNavigationNodeCollection nodes = spWeb.Navigation.UseShared ? null : spWeb.Navigation.TopNavigationBar;
     if ((nodes != null) && (nodes.Count > 0))
     {
         foreach (SPNavigationNode childNode in nodes)
         {
             if (childNode.Title != "Home")
             {
                 writer.Write("<li>");
                 writer.Write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                 writer.Write("<tr>");
                 writer.Write("<td class=\"menu_lbg\"></td>");
                 writer.Write("<td align=\"center\" class=\"menu_cbg\" nowrap><a class='ms-golballinks' href=\"" + childNode.Url + "\">" + childNode.Title + "</a></td>");
                 writer.Write("<td class=\"menu_rbg\"></td>");
                 writer.Write("</tr>");
                 writer.Write("</table>");
                 writer.Write("</li>");
             }
             else
                 continue;
             //QuickLaunch
             foreach (SPWeb web in spWeb.GetSubwebsForCurrentUser())
             {
                 if (web.Url.EndsWith(childNode.Url) && web.Title == childNode.Title)
                 {
                     SPNavigationNodeCollection quickLaunchList = web.Navigation.QuickLaunch;
                     if ((quickLaunchList != null) && (quickLaunchList.Count > 0))
                     {
                         writer.Write("<ul class=\"bg\">");
                         foreach (SPNavigationNode node in quickLaunchList)
                         {
                             foreach (SPNavigationNode node2 in node.Children)
                             {
                                 writer.Write("<li>");
                                 writer.Write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                                 writer.Write("<tr>");
                                 writer.Write("<td class=\"menu_lbg_sub\"></td>");
                                 writer.Write("<td align=\"center\" class=\"menu_cbg_sub\" nowrap><a class='sub_golballinks' href=\"" + node2.Url + "\">" + node2.Title + "</a></td>");
                                 writer.Write("<td class=\"menu_rbg_sub\"></td>");
                                 writer.Write("</tr>");
                                 writer.Write("</table>");
                                 writer.Write("</li>");
                             }
                         }
                         writer.Write("</ul>");
                     }
                 }
                 web.Dispose();
             }
         }
     }
 }
开发者ID:porter1130,项目名称:C-A,代码行数:54,代码来源:SiteNavigationHorizontal.cs


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