?? breadcrumb.cs
字號:
namespace ASPNET.StarterKit.Communities {
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
//*********************************************************************
//
// BreadCrumb Class
//
// WebControl that displays a navigation trail.
//
//*********************************************************************
public class BreadCrumb : WebControl {
//*********************************************************************
//
// SeparatorString Property
//
// Represents the characters that appear between the breadcrumb
// links. By default, a greater than sign >.
//
//*********************************************************************
public string SeparatorString {
get {
if (ViewState["Separator"] != null)
return (string)ViewState["Separator"];
else
return " > ";
}
set {
ViewState["Separator"] = value;
}
}
//*********************************************************************
//
// CreateChildControls Method
//
// Adds breadcrumb hyperlinks to the Controls collection.
//
//*********************************************************************
protected override void CreateChildControls() {
HyperLink lnkParent;
// Get Section Info from Context
SectionInfo sectionInfo = (SectionInfo)Context.Items["SectionInfo"];
// Find and add parents
while (sectionInfo != null) {
lnkParent = new HyperLink();
lnkParent.Text = sectionInfo.MenuTitle;
lnkParent.NavigateUrl = sectionInfo.Path;
Controls.Add(lnkParent);
sectionInfo = SectionUtility.GetSectionInfo(sectionInfo.ParentSectionID);
}
}
//*********************************************************************
//
// RenderContents Method
//
// Renders the BreadCrumb control to the browser by iterating
// through the Controls collection.
//
//*********************************************************************
protected override void RenderContents(HtmlTextWriter tw) {
for (int i = Controls.Count - 1;i > -1;i--) {
Controls[i].RenderControl(tw);
if (i > 0)
tw.Write( SeparatorString );
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -