File: SiteMapPath.cs

package info (click to toggle)
mono 6.12.0.199%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,296,836 kB
  • sloc: cs: 11,181,803; xml: 2,850,076; ansic: 699,709; cpp: 123,344; perl: 59,361; javascript: 30,841; asm: 21,853; makefile: 20,405; sh: 15,009; python: 4,839; pascal: 925; sql: 859; sed: 16; php: 1
file content (753 lines) | stat: -rw-r--r-- 25,270 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
//------------------------------------------------------------------------------
// <copyright file="SiteMapPath.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace System.Web.UI.WebControls {

    using System;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.Util;

    [
    Designer("System.Web.UI.Design.WebControls.SiteMapPathDesigner, " + AssemblyRef.SystemDesign)
    ]

    public class SiteMapPath : CompositeControl {

        private const string _defaultSeparator = " > ";

        private static readonly object _eventItemCreated = new object();
        private static readonly object _eventItemDataBound = new object();
        private SiteMapProvider _provider = null;

        private Style _currentNodeStyle;
        private Style _rootNodeStyle;
        private Style _nodeStyle;
        private Style _pathSeparatorStyle;

        private Style _mergedCurrentNodeStyle;
        private Style _mergedRootNodeStyle;

        private ITemplate _currentNodeTemplate;
        private ITemplate _rootNodeTemplate;
        private ITemplate _nodeTemplate;
        private ITemplate _pathSeparatorTemplate;


        public SiteMapPath() {
        }


        [
        DefaultValue(null),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        NotifyParentProperty(true),
        PersistenceMode(PersistenceMode.InnerProperty),
        WebCategory("Styles"),
        WebSysDescription(SR.SiteMapPath_CurrentNodeStyle)
        ]
        public Style CurrentNodeStyle {
            get {
                if (_currentNodeStyle == null) {
                    _currentNodeStyle = new Style();
                    if (IsTrackingViewState) {
                        ((IStateManager)_currentNodeStyle).TrackViewState();
                    }
                }

                return _currentNodeStyle;
            }
        }


        /// <devdoc>
        /// <para>Gets or sets the <see cref='System.Web.UI.ITemplate' qualify='true'/> that defines how the current node is rendered. </para>
        /// </devdoc>
        [
        Browsable(false),
        DefaultValue(null),
        PersistenceMode(PersistenceMode.InnerProperty),
        TemplateContainer(typeof(SiteMapNodeItem)),
        WebSysDescription(SR.SiteMapPath_CurrentNodeTemplate)
        ]
        public virtual ITemplate CurrentNodeTemplate {
            get {
                return _currentNodeTemplate;
            }
            set {
                _currentNodeTemplate = value;
            }
        }


        [
        DefaultValue(null),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        NotifyParentProperty(true),
        PersistenceMode(PersistenceMode.InnerProperty),
        WebCategory("Styles"),
        WebSysDescription(SR.SiteMapPath_NodeStyle)
        ]
        public Style NodeStyle {
            get {
                if (_nodeStyle == null) {
                    _nodeStyle = new Style();
                    if (IsTrackingViewState) {
                        ((IStateManager)_nodeStyle).TrackViewState();
                    }
                }

                return _nodeStyle;
            }
        }


        /// <devdoc>
        /// <para>Gets or sets the <see cref='System.Web.UI.ITemplate' qualify='true'/> that defines how the parent node is rendered. </para>
        /// </devdoc>
        [
        Browsable(false),
        DefaultValue(null),
        PersistenceMode(PersistenceMode.InnerProperty),
        TemplateContainer(typeof(SiteMapNodeItem)),
        WebSysDescription(SR.SiteMapPath_NodeTemplate)
        ]
        public virtual ITemplate NodeTemplate {
            get {
                return _nodeTemplate;
            }
            set {
                _nodeTemplate = value;
            }
        }


        /// <devdoc>
        ///    <para>Indicates the number of parent nodes to display.</para>
        /// </devdoc>
        [
        DefaultValue(-1),
        Themeable(false),
        WebCategory("Behavior"),
        WebSysDescription(SR.SiteMapPath_ParentLevelsDisplayed)
        ]
        public virtual int ParentLevelsDisplayed {
            get {
                object o = ViewState["ParentLevelsDisplayed"];
                if (o == null) {
                    return -1;
                }
                return (int)o;
            }
            set {
                if (value < -1) {
                    throw new ArgumentOutOfRangeException("value");
                }
                ViewState["ParentLevelsDisplayed"] = value;
            }
        }


        [
        DefaultValue(PathDirection.RootToCurrent),
        WebCategory("Appearance"),
        WebSysDescription(SR.SiteMapPath_PathDirection)
        ]
        public virtual PathDirection PathDirection {
            get {
                object o = ViewState["PathDirection"];
                if (o == null) {
                    return PathDirection.RootToCurrent;
                }
                return (PathDirection)o;
            }
            set {
                if ((value < PathDirection.RootToCurrent) || (value > PathDirection.CurrentToRoot)) {
                    throw new ArgumentOutOfRangeException("value");
                }
                ViewState["PathDirection"] = value;
            }
        }


        [
        DefaultValue(_defaultSeparator),
        Localizable(true),
        WebCategory("Appearance"),
        WebSysDescription(SR.SiteMapPath_PathSeparator)
        ]
        public virtual string PathSeparator {
            get {
                string s = (string)ViewState["PathSeparator"];
                if (s == null) {
                    return _defaultSeparator;
                }
                return s;
            }
            set {
                ViewState["PathSeparator"] = value;
            }
        }


        [
        DefaultValue(null),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        NotifyParentProperty(true),
        PersistenceMode(PersistenceMode.InnerProperty),
        WebCategory("Styles"),
        WebSysDescription(SR.SiteMapPath_PathSeparatorStyle)
        ]
        public Style PathSeparatorStyle {
            get {
                if (_pathSeparatorStyle == null) {
                    _pathSeparatorStyle = new Style();
                    if (IsTrackingViewState) {
                        ((IStateManager)_pathSeparatorStyle).TrackViewState();
                    }
                }

                return _pathSeparatorStyle;
            }
        }


        /// <devdoc>
        /// <para>Gets or sets the <see cref='System.Web.UI.ITemplate' qualify='true'/> that defines how the path Separator is rendered. </para>
        /// </devdoc>
        [
        Browsable(false),
        DefaultValue(null),
        PersistenceMode(PersistenceMode.InnerProperty),
        TemplateContainer(typeof(SiteMapNodeItem)),
        WebSysDescription(SR.SiteMapPath_PathSeparatorTemplate)
        ]
        public virtual ITemplate PathSeparatorTemplate {
            get {
                return _pathSeparatorTemplate;
            }
            set {
                _pathSeparatorTemplate = value;
            }
        }


        [
        Browsable(false),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
        WebSysDescription(SR.SiteMapPath_Provider)
        ]
        public SiteMapProvider Provider {
            get {
                // Designer must specify a provider, as code below access runtime config
                if (_provider != null || DesignMode)
                    return _provider;

                // If not specified, use the default provider.
                if (String.IsNullOrEmpty(SiteMapProvider)) {
                    _provider = SiteMap.Provider;

                    if (_provider == null) {
                        throw new HttpException(SR.GetString(SR.SiteMapDataSource_DefaultProviderNotFound));
                    }
                }
                else {
                    _provider = SiteMap.Providers[SiteMapProvider];

                    if (_provider == null) {
                        throw new HttpException(SR.GetString(SR.SiteMapDataSource_ProviderNotFound, SiteMapProvider));
                    }
                }

                return _provider;
            }
            set {
                _provider = value;
            }
        }


        [
        DefaultValue(false),
        WebCategory("Appearance"),
        WebSysDescription(SR.SiteMapPath_RenderCurrentNodeAsLink)
        ]
        public virtual bool RenderCurrentNodeAsLink {
            get {
                object o = ViewState["RenderCurrentNodeAsLink"];
                if (o == null) {
                    return false;
                }

                return (bool)o;
            }
            set {
                ViewState["RenderCurrentNodeAsLink"] = value;
            }
        }


        [
        DefaultValue(null),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        NotifyParentProperty(true),
        PersistenceMode(PersistenceMode.InnerProperty),
        WebCategory("Styles"),
        WebSysDescription(SR.SiteMapPath_RootNodeStyle)
        ]
        public Style RootNodeStyle {
            get {
                if (_rootNodeStyle == null) {
                    _rootNodeStyle = new Style();
                    if (IsTrackingViewState) {
                        ((IStateManager)_rootNodeStyle).TrackViewState();
                    }
                }

                return _rootNodeStyle;
            }
        }


        /// <devdoc>
        /// <para>Gets or sets the <see cref='System.Web.UI.ITemplate' qualify='true'/> that defines how the root node is rendered. </para>
        /// </devdoc>
        [
        Browsable(false),
        DefaultValue(null),
        PersistenceMode(PersistenceMode.InnerProperty),
        TemplateContainer(typeof(SiteMapNodeItem)),
        WebSysDescription(SR.SiteMapPath_RootNodeTemplate)
        ]
        public virtual ITemplate RootNodeTemplate {
            get {
                return _rootNodeTemplate;
            }
            set {
                _rootNodeTemplate = value;
            }
        }


        [
        Localizable(true),
        WebCategory("Accessibility"),
        WebSysDefaultValue(SR.SiteMapPath_Default_SkipToContentText),
        WebSysDescription(SR.SiteMapPath_SkipToContentText)
        ]
        public virtual String SkipLinkText {
            get {
                string s = ViewState["SkipLinkText"] as String;
                return s == null ? SR.GetString(SR.SiteMapPath_Default_SkipToContentText) : s;
            }
            set {
                ViewState["SkipLinkText"] = value;
            }
        }


        [
        DefaultValue(true),
        Themeable(false),
        WebCategory("Behavior"),
        WebSysDescription(SR.SiteMapPath_ShowToolTips)
        ]
        public virtual bool ShowToolTips {
            get {
                object o = ViewState["ShowToolTips"];
                if (o == null) {
                    return true;
                }

                return (bool)o;
            }
            set {
                ViewState["ShowToolTips"] = value;
            }
        }


        [
        DefaultValue(""),
        Themeable(false),
        WebCategory("Behavior"),
        WebSysDescription(SR.SiteMapPath_SiteMapProvider)
        ]
        public virtual string SiteMapProvider {
            get {
                string provider = ViewState["SiteMapProvider"] as string;
                return (provider == null) ? String.Empty : provider;
            }
            set {
                ViewState["SiteMapProvider"] = value;
                _provider = null;
            }
        }


        [
        WebCategory("Action"),
        WebSysDescription(SR.DataControls_OnItemCreated)
        ]
        public event SiteMapNodeItemEventHandler ItemCreated {
            add {
                Events.AddHandler(_eventItemCreated, value);
            }
            remove {
                Events.RemoveHandler(_eventItemCreated, value);
            }
        }


        /// <devdoc>
        /// <para>Occurs when an item is databound within a <see cref='System.Web.UI.WebControls.SiteMapPath'/> control tree.</para>
        /// </devdoc>
        [
        WebCategory("Action"),
        WebSysDescription(SR.SiteMapPath_OnItemDataBound)
        ]
        public event SiteMapNodeItemEventHandler ItemDataBound {
            add {
                Events.AddHandler(_eventItemDataBound, value);
            }
            remove {
                Events.RemoveHandler(_eventItemDataBound, value);
            }
        }


        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void CreateChildControls() {
            Controls.Clear();
            CreateControlHierarchy();
            ClearChildState();
        }


        /// <devdoc>
        ///    A protected method. Creates a control hierarchy based on current sitemap OM.
        /// </devdoc>
        protected virtual void CreateControlHierarchy() {
            if (Provider == null)
                return;

            int index = 0;

            CreateMergedStyles();

            SiteMapNode currentNode = Provider.GetCurrentNodeAndHintAncestorNodes(-1);
            if (currentNode != null) {
                SiteMapNode parentNode = currentNode.ParentNode;
                if (parentNode != null) {
                    CreateControlHierarchyRecursive(ref index, parentNode, ParentLevelsDisplayed);
                }

                CreateItem(index++, SiteMapNodeItemType.Current, currentNode);
            }
        }

        private void CreateControlHierarchyRecursive(ref int index, SiteMapNode node, int parentLevels) {
            if (parentLevels == 0)
                return;

            SiteMapNode parentNode = node.ParentNode;
            if (parentNode != null) {
                CreateControlHierarchyRecursive(ref index, parentNode, parentLevels - 1);
                CreateItem(index++, SiteMapNodeItemType.Parent, node);
            }
            else {
                CreateItem(index++, SiteMapNodeItemType.Root, node);
            }

            CreateItem(index, SiteMapNodeItemType.PathSeparator, null);
        }

        private SiteMapNodeItem CreateItem(int itemIndex, SiteMapNodeItemType itemType, SiteMapNode node) {
            SiteMapNodeItem item = new SiteMapNodeItem(itemIndex, itemType);

            int index = (PathDirection == PathDirection.CurrentToRoot ? 0 : -1);

            SiteMapNodeItemEventArgs e = new SiteMapNodeItemEventArgs(item);

            //Add sitemap nodes so that they are accessible during events.
            item.SiteMapNode = node;
            InitializeItem(item);

            // Notify items
            OnItemCreated(e);

            // Add items based on PathDirection.
            Controls.AddAt(index, item);

            // Databind.
            item.DataBind();

            // Notify items.
            OnItemDataBound(e);

            item.SiteMapNode = null;

            // SiteMapNodeItem is dynamically created each time, don't track viewstate.
            item.EnableViewState = false;

            return item;
        }

        private void CopyStyle(Style toStyle, Style fromStyle) {
            Debug.Assert(toStyle != null);

            // Review: How to change the default value of Font.Underline?
            if (fromStyle != null && fromStyle.IsSet(System.Web.UI.WebControls.Style.PROP_FONT_UNDERLINE))
                toStyle.Font.Underline = fromStyle.Font.Underline;

            toStyle.CopyFrom(fromStyle);
        }

        private void CreateMergedStyles() {
            _mergedCurrentNodeStyle = new Style();
            CopyStyle(_mergedCurrentNodeStyle, _nodeStyle);
            CopyStyle(_mergedCurrentNodeStyle, _currentNodeStyle);

            _mergedRootNodeStyle = new Style();
            CopyStyle(_mergedRootNodeStyle, _nodeStyle);
            CopyStyle(_mergedRootNodeStyle, _rootNodeStyle);
        }


        /// <internalonly/>
        /// <devdoc>
        /// <para>Overriden to handle our own databinding.</para>
        /// </devdoc>
        public override void DataBind() {
            // do our own databinding
            OnDataBinding(EventArgs.Empty);

            // contained items will be databound after they have been created,
            // so we don't want to walk the hierarchy here.
        }


        /// <devdoc>
        /// <para>A protected method. Populates iteratively the specified <see cref='System.Web.UI.WebControls.SiteMapNodeItem'/> with a
        ///    sub-hierarchy of child controls.</para>
        /// </devdoc>
        protected virtual void InitializeItem(SiteMapNodeItem item) {
            Debug.Assert(_mergedCurrentNodeStyle != null && _mergedRootNodeStyle != null);

            ITemplate template = null;
            Style style = null;
            SiteMapNodeItemType itemType = item.ItemType;
            SiteMapNode node = item.SiteMapNode;

            switch (itemType) {
                case SiteMapNodeItemType.Root:
                    template = RootNodeTemplate != null ? RootNodeTemplate : NodeTemplate;
                    style = _mergedRootNodeStyle;
                    break;

                case SiteMapNodeItemType.Parent:
                    template = NodeTemplate;
                    style = _nodeStyle;
                    break;

                case SiteMapNodeItemType.Current:
                    template = CurrentNodeTemplate != null ? CurrentNodeTemplate : NodeTemplate;
                    style = _mergedCurrentNodeStyle;
                    break;

                case SiteMapNodeItemType.PathSeparator:
                    template = PathSeparatorTemplate;
                    style = _pathSeparatorStyle;
                    break;
            }

            if (template == null) {
                if (itemType == SiteMapNodeItemType.PathSeparator) {
                    Literal separatorLiteral = new Literal();
                    separatorLiteral.Mode = LiteralMode.Encode;
                    separatorLiteral.Text = PathSeparator;
                    item.Controls.Add(separatorLiteral);
                    item.ApplyStyle(style);
                }
                else if (itemType == SiteMapNodeItemType.Current && !RenderCurrentNodeAsLink) {
                    Literal currentNodeLiteral = new Literal();
                    currentNodeLiteral.Mode = LiteralMode.Encode;
                    currentNodeLiteral.Text = node.Title;
                    item.Controls.Add(currentNodeLiteral);
                    item.ApplyStyle(style);
                }
                else {
                    HyperLink link = new HyperLink();

                    if (style != null && style.IsSet(System.Web.UI.WebControls.Style.PROP_FONT_UNDERLINE))
                        link.Font.Underline = style.Font.Underline;

                    link.EnableTheming = false;
                    link.Enabled = this.Enabled;
                    // VSWhidbey 281869 Don't modify input when url pointing to unc share
                    if (node.Url.StartsWith("\\\\", StringComparison.Ordinal)) {
                        link.NavigateUrl = ResolveClientUrl(HttpUtility.UrlPathEncode(node.Url));
                    }
                    else {
                        link.NavigateUrl = Context != null ?
                            Context.Response.ApplyAppPathModifier(ResolveClientUrl(HttpUtility.UrlPathEncode(node.Url))) : node.Url;
                    }
                    link.Text = HttpUtility.HtmlEncode(node.Title);
                    if (ShowToolTips)
                        link.ToolTip = node.Description;
                    item.Controls.Add(link);
                    link.ApplyStyle(style);
                }
            }
            else {
                template.InstantiateIn(item);
                item.ApplyStyle(style);
            }
        }


        /// <internalonly/>
        /// <devdoc>
        /// <para>Loads a saved state of the <see cref='System.Web.UI.WebControls.SiteMapPath'/>. </para>
        /// </devdoc>
        protected override void LoadViewState(object savedState) {
            if (savedState != null) {
                object[] myState = (object[])savedState;

                Debug.Assert(myState.Length == 5);

                base.LoadViewState(myState[0]);

                if (myState[1] != null)
                    ((IStateManager)CurrentNodeStyle).LoadViewState(myState[1]);

                if (myState[2] != null)
                    ((IStateManager)NodeStyle).LoadViewState(myState[2]);

                if (myState[3] != null)
                    ((IStateManager)RootNodeStyle).LoadViewState(myState[3]);

                if (myState[4] != null)
                    ((IStateManager)PathSeparatorStyle).LoadViewState(myState[4]);
            }
            else {
                base.LoadViewState(null);
            }
        }


        /// <internalonly/>
        /// <devdoc>
        /// <para>A protected method. Raises the <see langword='DataBinding'/> event.</para>
        /// </devdoc>
        protected override void OnDataBinding(EventArgs e) {
            base.OnDataBinding(e);

            // reset the control state
            Controls.Clear();
            ClearChildState();

            CreateControlHierarchy();
            ChildControlsCreated = true;
        }


        /// <devdoc>
        /// <para>A protected method. Raises the <see langword='ItemCreated'/> event.</para>
        /// </devdoc>
        protected virtual void OnItemCreated(SiteMapNodeItemEventArgs e) {
            SiteMapNodeItemEventHandler onItemCreatedHandler =
                (SiteMapNodeItemEventHandler)Events[_eventItemCreated];
            if (onItemCreatedHandler != null) {
                onItemCreatedHandler(this, e);
            }
        }


        /// <devdoc>
        /// <para>A protected method. Raises the <see langword='ItemDataBound'/>
        /// event.</para>
        /// </devdoc>
        protected virtual void OnItemDataBound(SiteMapNodeItemEventArgs e) {
            SiteMapNodeItemEventHandler onItemDataBoundHandler =
                (SiteMapNodeItemEventHandler)Events[_eventItemDataBound];
            if (onItemDataBoundHandler != null) {
                onItemDataBoundHandler(this, e);
            }
        }


        /// <devdoc>
        /// </devdoc>
        protected internal override void Render(HtmlTextWriter writer) {
            // Copied from CompositeControl.cs
            if (DesignMode) {
                ChildControlsCreated = false;
                EnsureChildControls();
            }

            base.Render(writer);
        }


        /// <devdoc>
        ///     Adds the SkipToContextText.
        /// </devdoc>

        protected internal override void RenderContents(HtmlTextWriter writer) {
            ControlRenderingHelper.WriteSkipLinkStart(writer, RenderingCompatibility, DesignMode, SkipLinkText, SpacerImageUrl, ClientID);

            base.RenderContents(writer);

            ControlRenderingHelper.WriteSkipLinkEnd(writer, DesignMode, SkipLinkText, ClientID);
        }

        /// <internalonly/>
        /// <devdoc>
        /// <para>Stores the state of the System.Web.UI.WebControls.SiteMapPath.</para>
        /// </devdoc>
        protected override object SaveViewState() {
            object[] myState = new object[5];

            myState[0] = base.SaveViewState();
            myState[1] = (_currentNodeStyle != null) ? ((IStateManager)_currentNodeStyle).SaveViewState() : null;
            myState[2] = (_nodeStyle != null) ? ((IStateManager)_nodeStyle).SaveViewState() : null;
            myState[3] = (_rootNodeStyle != null) ? ((IStateManager)_rootNodeStyle).SaveViewState() : null;
            myState[4] = (_pathSeparatorStyle != null) ? ((IStateManager)_pathSeparatorStyle).SaveViewState() : null;

            for (int i = 0; i < myState.Length; i++) {
                if (myState[i] != null)
                    return myState;
            }

            return null;
        }

        /// <internalonly/>
        /// <devdoc>
        ///    <para>Marks the starting point to begin tracking and saving changes to the
        ///       control as part of the control viewstate.</para>
        /// </devdoc>
        protected override void TrackViewState() {
            base.TrackViewState();

            if (_currentNodeStyle != null)
                ((IStateManager)_currentNodeStyle).TrackViewState();

            if (_nodeStyle != null)
                ((IStateManager)_nodeStyle).TrackViewState();

            if (_rootNodeStyle != null)
                ((IStateManager)_rootNodeStyle).TrackViewState();

            if (_pathSeparatorStyle != null)
                ((IStateManager)_pathSeparatorStyle).TrackViewState();
        }
    }
}