TextBox rendered as Label
I would probably have a custom control that wrapped instances of the controls instead of directly inheriting from one of two possible controls, if that makes sense.

This approach leaves your code more open in the future and allows you to add additional features as part of your control (like validation controls for example) that conditionally become applied when the mode is set to a TextBox.

Here is what I came up with (this should be a run-able example):



using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomControls.Web {

    [DesignTimeVisible(true)]
    [ToolboxData("&lt;{0}:TextBoxLabel ID='' runat='server' /&gt;")]
    [DefaultProperty("Text")]
    public class TextBoxLabel : WebControl {

        #region --Instance Variables--

        private Label _ctlLabel;
        private TextBox _ctlTextBox;
        private TextBoxLabelModes _mode;
        private WebControl _renderedControl;
        private string _text;

        #endregion

        #region --Constructors--

        /// &lt;summary&gt;
        /// Creates a new instance of the TextBoxLabel class.
        /// &lt;/summary&gt;
        public TextBoxLabel()
            : base() {
                _ctlLabel = new Label();
                _ctlTextBox = new TextBox();
                _mode = TextBoxLabelModes.Default;
                _renderedControl = null;
                _text = string.Empty;
        } // end constructor

        #endregion

        #region --Methods--

        protected override void CreateChildControls() {
            base.CreateChildControls();
            if (this._mode == TextBoxLabelModes.TextBox) {
                _renderedControl = this._ctlTextBox;
            } else {
                _renderedControl = this._ctlLabel;
            }
            _renderedControl.ID = this.ID;
        } // end method CreateChildControls

        public override void RenderControl(HtmlTextWriter writer) {
            _renderedControl.RenderControl(writer);
        } // end method RenderControl

        #endregion

        #region --Properties--

        [Category("Appearance")]
        public virtual TextBoxLabelModes ControlMode {
            get {
                return _mode;
            } set {
                _mode = value;
            }
        } // end property ControlMode

        [Category("Data")]
        public virtual string Text {
            get {
                return _text;
            } set {
                if (!string.IsNullOrWhiteSpace(value)) {
                    _text = value;
                    _ctlLabel.Text = value;
                    _ctlTextBox.Text = value;
                } // end if
            }
        } // end property Text

        #endregion

    } // end class TextBoxLabel

    public enum TextBoxLabelModes : int {

        Default = 0,

        Label = 1,

        TextBox = 2
    }

} // end namespace