📄 basenavigator.cs
字号:
}
}
/// <summary>
/// Default target (frame or window) to use when navigating.
/// </summary>
/// <seealso cref="NavigationNode.NavigateUrl" />
[Category("Navigation")]
[Description("Default target frame. ")]
[DefaultValue("")]
public string DefaultTarget
{
get
{
object o = ViewState["DefaultTarget"];
return (o == null) ? String.Empty : (string)o;
}
set
{
ViewState["DefaultTarget"] = value;
}
}
/// <summary>
/// The NavigateUrl of the first node in the group.
/// </summary>
[Description("The NavigateUrl of the first node in the group. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string FirstInGroupUrl
{
get
{
if(this.selectedNode != null)
{
if(this.selectedNode.parentNode != null)
{
return this.selectedNode.parentNode.nodes[0].NavigateUrl;
}
else
{
return this.FirstUrl;
}
}
else
{
return this.FirstUrl;
}
}
}
/// <summary>
/// The NavigateUrl of the first node in the tree.
/// </summary>
[Description("The NavigateUrl of the first node in the tree. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string FirstUrl
{
get
{
if(this.nodes != null && this.nodes.Count > 0)
{
return this.nodes[0].NavigateUrl;
}
else
{
return null;
}
}
}
/// <summary>
/// Whether to force the rendering of the search engine structure. Default: false.
/// </summary>
[Category("Support")]
[Description("Whether to force the rendering of the search engine structure. Default: false.")]
[DefaultValue(false)]
public bool ForceSearchEngineStructure
{
get
{
object o = ViewState["ForceSearchEngineStructure"];
return (o == null) ? false : (bool) o;
}
set
{
ViewState["ForceSearchEngineStructure"] = value;
}
}
/// <summary>
/// Whether to visually distinguish Selected node and its parent nodes from other non-Selected nodes.
/// </summary>
/// <remarks>
/// For this to work, Selected and/or ChildSelected styles must be defined.
/// </remarks>
[Category("Behavior")]
[Description("Whether to visually distinguish Selected node and its parent nodes from other non-Selected nodes.")]
[DefaultValue(true)]
public bool HighlightSelectedPath
{
get
{
return Utils.ParseBool(ViewState["HighlightSelectedPath"], true);
}
set
{
ViewState["HighlightSelectedPath"] = value;
}
}
/// <summary>
/// Prefix to use for all image URL paths. For non-image URLs, use BaseUrl.
/// </summary>
[Category("Support")]
[Description("Used as a prefix for all image URLs. ")]
[DefaultValue("")]
public virtual string ImagesBaseUrl
{
get
{
object o = ViewState["ImagesBaseUrl"];
return (o == null) ? String.Empty : Utils.ConvertUrl(Context, string.Empty, (string)o);
}
set
{
ViewState["ImagesBaseUrl"] = value;
}
}
/// <summary>
/// The NavigateUrl of the first node in the group.
/// </summary>
[Description("The NavigateUrl of the first node in the group. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string LastInGroupUrl
{
get
{
if(this.selectedNode != null)
{
if(this.selectedNode.parentNode != null)
{
return this.selectedNode.parentNode.nodes[this.selectedNode.parentNode.nodes.Count - 1].NavigateUrl;
}
else
{
return this.LastUrl;
}
}
else
{
return null;
}
}
}
/// <summary>
/// The NavigateUrl of the last node in the tree.
/// </summary>
[Description("The NavigateUrl of the last node in the tree. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string LastUrl
{
get
{
if(this.nodes != null && this.nodes.Count > 0)
{
NavigationNode oLastNode = this.nodes[this.nodes.Count - 1];
while(oLastNode.nodes != null && oLastNode.nodes.Count > 0)
{
oLastNode = oLastNode.nodes[oLastNode.nodes.Count - 1];
}
return oLastNode.NavigateUrl;
}
else
{
return null;
}
}
}
/// <summary>
/// The NavigateUrl of the next node in the group.
/// </summary>
[Description("The NavigateUrl of the next node in the group. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string NextInGroupUrl
{
get
{
if(this.selectedNode != null)
{
if(this.selectedNode.nextSibling != null)
{
return this.selectedNode.nextSibling.NavigateUrl;
}
else
{
return this.selectedNode.NavigateUrl;
}
}
else
{
return null;
}
}
}
/// <summary>
/// The NavigateUrl of the next node in the tree.
/// </summary>
[Description("The NavigateUrl of the next node in the tree. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string NextUrl
{
get
{
if (this.selectedNode == null)
{
return null;
}
else
{
this.PopulateNodeNextUrls();
return this.selectedNode.nextUrl;
}
}
}
/// <summary>
/// Whether to persist custom attributes of nodes to JavaScript. Default: true.
/// </summary>
[Description("Whether to persist custom attributes of nodes to JavaScript. Default: true.")]
[DefaultValue(true)]
public bool OutputCustomAttributes
{
get
{
object o = ViewState["OutputCustomAttributes"];
return (o == null) ? true : Utils.ParseBool(o,true);
}
set
{
ViewState["OutputCustomAttributes"] = value;
}
}
/// <summary>
/// Whether to pre-render the entire structure on the client, instead of only the initially visible parts. Default: false.
/// </summary>
/// <remarks>
/// Setting this property to <b>true</b> can improve the reliability of the control in rare situations where
/// caching is disabled in the browser, and not forceable by IIS, when images are used extensively. Using
/// this feature degrades the performance of the control in all situations, however.
/// </remarks>
[Description("Whether to pre-render the entire structure, instead of only the initially visible parts. Default: false.")]
[DefaultValue(false)]
public virtual bool PreRenderAllLevels
{
get
{
object o = ViewState["PreRenderAllLevels"];
return (o == null) ? false : (bool) o;
}
set
{
ViewState["PreRenderAllLevels"] = value;
}
}
/// <summary>
/// The NavigateUrl of the previous node in the group.
/// </summary>
[Description("The NavigateUrl of the previous node in the group. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string PreviousInGroupUrl
{
get
{
if(this.selectedNode != null)
{
if(this.selectedNode.previousSibling != null)
{
return this.selectedNode.previousSibling.NavigateUrl;
}
else
{
return this.selectedNode.NavigateUrl;
}
}
else
{
return null;
}
}
}
/// <summary>
/// The NavigateUrl of the previous node in the tree.
/// </summary>
[Description("The NavigateUrl of the previous node in the tree. ")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string PreviousUrl
{
get
{
if (this.selectedNode == null)
{
return null;
}
else
{
this.PopulateNodePreviousUrls();
return this.selectedNode.previousUrl;
}
}
}
/// <summary>
/// Whether to render the search engine structure for detected crawlers. Default: true.
/// </summary>
[Category("Support")]
[Description("Whether to render the search engine structure for detected crawlers. Default: true.")]
[DefaultValue(true)]
public bool RenderSearchEngineStructure
{
get
{
object o = ViewState["RenderSearchEngineStructure"];
return (o == null) ? true : (bool) o;
}
set
{
ViewState["RenderSearchEngineStructure"] = value;
}
}
/// <summary>
/// Depth from RenderRoot(Node|Item) to render to.
/// </summary>
[Category("Data")]
[Description("Depth from RenderRootNode to render to. Default: 0.")]
[DefaultValue(0)]
public int RenderDrillDownDepth
{
get
{
object o = ViewState["RenderDrillDownDepth"];
return (o == null) ? 0 : (int)o;
}
set
{
ViewState["RenderDrillDownDepth"] = value;
}
}
/// <summary>
/// ID of node to begin rendering down from.
/// </summary>
[Description("ID of node to begin rendering down from.")]
[DefaultValue("")]
protected string RenderRootNodeId
{
get
{
object o = ViewState["RenderRootNodeId"];
return (o == null) ? string.Empty : (string)o;
}
set
{
ViewState["RenderRootNodeId"] = value;
}
}
/// <summary>
/// Whether to include the RenderRootNode when rendering, instead of only its children. Default: false.
/// </summary>
[DefaultValue(false)]
protected bool RenderRootNodeInclude
{
get
{
object o = ViewState["RenderRootNodeInclude"];
return (o == null) ? false : (bool)o;
}
set
{
ViewState["RenderRootNodeInclude"] = value;
}
}
/// <summary>
/// Path to the site map XML file.
/// </summary>
/// <seealso cref="DataSource" />
/// <seealso cref="LoadXml" />
[Category("Data")]
[DefaultValue("")]
[Description("Path to the site map XML file. ")]
[Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string SiteMapXmlFile
{
get
{
object o = ViewState["SiteMapXmlFile"];
return (o == null) ? String.Empty : (string)o;
}
set
{
ViewState["SiteMapXmlFile"] = value;
if(Context != null)
{
string sServerPath = Context.Server.MapPath(value);
if(!File.Exists(sServerPath))
{
throw new FileNotFoundException("Specified SiteMapXmlFile (" + value + ") does not exist.");
}
// Load XML from SiteMapXmlFile
XmlDocument oXmlDoc = new XmlDocument();
oXmlDoc.Load(sServerPath);
this.LoadXml(oXmlDoc);
ComponentArtFixStructure();
this.UpdateSelectedNode();
bNewDataLoaded = true;
}
}
}
/// <summary>
/// ID of ComponentArt MultiPage to control from this navigator.
/// </summary>
/// <seealso cref="NavigationNode.PageViewId" />
[Description("ID of ComponentArt MultiPage to control from this navigator.")]
[Category("Behavior")]
[DefaultValue("")]
public string MultiPageId
{
get
{
object o = ViewState["MultiPageId"];
return (o == null) ? string.Empty : (string)o;
}
set
{
ViewState["MultiPageId"] = value;
}
}
#endregion
#region Public Methods
/// <summary>
/// Bind to the current DataSource.
/// </summary>
/// <seealso cref="DataSource" />
public override void DataBind()
{
if(this.DataSource == null)
{
return;
}
if(this.DataSource is DataSet)
{
DataSet oDS = (DataSet)(this.DataSource);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -