WizardStepBase.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / WizardStepBase.cs / 1 / WizardStepBase.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.UI.WebControls { 
 
    using System;
    using System.CodeDom.Compiler; 
    using System.Collections;
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Web; 
    using System.Web.UI;
 
 
    [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public sealed class WizardStepControlBuilder : ControlBuilder { 
        internal override void SetParentBuilder(ControlBuilder parentBuilder) {
            // Do not check containment at designtime or in a skin file.
            if (Parser.FInDesigner || Parser is PageThemeParser)
                return; 

            if (parentBuilder.ControlType == null || 
                !(typeof(WizardStepCollection).IsAssignableFrom(parentBuilder.ControlType))) { 
                throw new HttpException(SR.GetString(SR.WizardStep_WrongContainment));
            } 

            base.SetParentBuilder(parentBuilder);
        }
    } 

    [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
    [
    Bindable(false), 
    ControlBuilderAttribute(typeof(WizardStepControlBuilder)),
    ToolboxItem(false)
    ]
    public abstract class WizardStepBase : View { 
        private Wizard _owner;
 
        [ 
        WebCategory("Behavior"),
        Themeable(false), 
        Filterable(false),
        DefaultValue(true),
        WebSysDescription(SR.WizardStep_AllowReturn)
        ] 
        public virtual bool AllowReturn {
            get { 
                object o = ViewState["AllowReturn"]; 
                return o == null? true : (bool)o;
            } 
            set {
                ViewState["AllowReturn"] = value;
            }
        } 

        ///  
        ///    Gets and sets a value indicating whether theme is enabled. 
        /// 
        [ 
        Browsable(true)
        ]
        public override bool EnableTheming {
            get { 
                return base.EnableTheming;
            } 
            set { 
                base.EnableTheming = value;
            } 
        }

        public override string ID {
            get { 
                return base.ID;
            } 
            set { 
                // VSWhidbey 407127. Need to validate control ID here since WiardStepBase does not have a designer.
                if (Owner != null && Owner.DesignMode) { 
                    if (!CodeGenerator.IsValidLanguageIndependentIdentifier(value)) {
                        throw new ArgumentException(SR.GetString(SR.Invalid_identifier, value));
                    }
 
                    if (value != null && value.Equals(Owner.ID, StringComparison.OrdinalIgnoreCase)) {
                        throw new ArgumentException(SR.GetString(SR.Id_already_used, value)); 
                    } 

                    foreach (WizardStepBase step in Owner.WizardSteps) { 
                        if (step == this) {
                            continue;
                        }
 
                        if (step.ID != null && step.ID.Equals(value, StringComparison.OrdinalIgnoreCase)) {
                            throw new ArgumentException(SR.GetString(SR.Id_already_used, value)); 
                        } 
                    }
                } 

                base.ID = value;
            }
        } 

        [ 
        Browsable(false), 
        DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
        WebCategory("Appearance"), 
        WebSysDescription(SR.WizardStep_Name)
        ]
        public virtual String Name {
            get { 
                if (!String.IsNullOrEmpty(Title)) {
                    return Title; 
                } 

                if (!String.IsNullOrEmpty(ID)) { 
                    return ID;
                }

                return null; 
            }
        } 
 
        internal virtual Wizard Owner {
            get { 
                return _owner;
            }
            set {
                _owner = value; 
            }
        } 
 
        [
        WebCategory("Behavior"), 
        DefaultValue(WizardStepType.Auto),
        WebSysDescription(SR.WizardStep_StepType)
        ]
        public virtual WizardStepType StepType { 
            get {
                object o = ViewState["StepType"]; 
                return o == null? WizardStepType.Auto : (WizardStepType)o; 
            }
            set { 
                if (value < WizardStepType.Auto || value > WizardStepType.Step) {
                    throw new ArgumentOutOfRangeException("value");
                }
 
                if (StepType != value) {
                    ViewState["StepType"] = value; 
                    if (Owner != null) { 
                        Owner.OnWizardStepsChanged();
                    } 
                }
            }
        }
 
        /// 
        /// Gets or sets the title on the