ASP.NET composite control FromToTextBoxes

This is a simple composite control , that has 2 edit text boxes with corresponding labels.
It will be useful to have labels as public properties (not done yet)
The possible and popular extension will be to have From/To date controls.

 The source code posted using CopySourceAsHtml

 

using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

 

 //based on http://localhost/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/ctrlauth/composition/Composition1.src&file=CSComposition1.cs&font=3

    /// <summary>

    /// Summary description for FromToTextBoxes.

    /// </summary>

    public class FromToTextBoxes: Control, INamingContainer

    {

        public FromToTextBoxes()

        {

            //

            // TODO: Add constructor logic here

            //

        }

        #region   “Private properties”

            private TextBox m_txtFrom;

            private TextBox m_txtTo;

        #endregion  // “Private properties”

 

        #region  “Public properties”

        public string FromValue

        {

            get

            {

                this.EnsureChildControls();

                return m_txtFrom.Text;

            }

            set

            {

                this.EnsureChildControls();

                m_txtFrom.Text = value.ToString();

            }

        }

        public string ToValue

        {

            get

            {

                this.EnsureChildControls();

                return m_txtTo.Text;

            }

            set

            {

                this.EnsureChildControls();

                m_txtTo.Text = value.ToString();

            }

        }

        #endregion  //”Public properties”

 

        protected override void CreateChildControls()

        {

 

            this.Controls.Add(new LiteralControl( ” From: “));

            m_txtFrom = new TextBox();

            m_txtFrom.ID=“txtFrom”;

            //box.Text = “0”;

            this.Controls.Add(m_txtFrom);

            this.Controls.Add(new LiteralControl(” To: “));

            m_txtTo = new TextBox();

            m_txtTo.ID=“txtTo”;

            this.Controls.Add(m_txtTo);

        }

    }