本文整理汇总了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%'> </td>");
writer.WriteLine("<td width='10%' class='nav-sub-center'> </td>");
writer.WriteLine("<td align='left' NOWRAP> <a class='nav-sub-right' href=\"" + node2.Url + "\">" + node2.Title + "</a></td>");
writer.WriteLine("</tr>");
}
}
writer.WriteLine("</table>");
}
}
web.Dispose();
}
temp++;
writer.WriteLine("</div>");
}
}
}
示例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();
}
}
}
}