StringPropertyBuilder.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 / StringPropertyBuilder.cs / 1 / StringPropertyBuilder.cs

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

namespace System.Web.UI { 
    using System; 
    using System.Collections;
 
    /// 
    /// Builds inner string properties.
    /// 
    internal sealed class StringPropertyBuilder : ControlBuilder { 
        private string _text;
 
 
        /// 
        /// Creates a new instance of StringPropertyBuilder. 
        /// 
        internal StringPropertyBuilder() {
        }
 
        internal StringPropertyBuilder(string text) {
            _text = text; 
        } 

        ///  
        /// Returns the inner text of the property.
        /// 
        public string Text {
            get { 
                return (_text == null) ? String.Empty : _text;
            } 
        } 

        ///  
        /// Gets the inner text of the property.
        /// 
        public override void AppendLiteralString(string s) {
            if (ParentBuilder != null && ParentBuilder.HtmlDecodeLiterals()) 
                s = HttpUtility.HtmlDecode(s);
 
            _text = s; 
        }
 
        /// 
        /// Throws an exception - string properties cannot contain other objects.
        /// 
        public override void AppendSubBuilder(ControlBuilder subBuilder) { 
            throw new HttpException(SR.GetString(SR.StringPropertyBuilder_CannotHaveChildObjects, TagName, (ParentBuilder != null ? ParentBuilder.TagName : String.Empty)));
        } 
 
        public override object BuildObject() {
            return Text; 
        }

        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName, string ID, IDictionary attribs) { 

            base.Init(parser, parentBuilder, type /*type*/, tagName, ID, attribs); 
 
            SetControlType(typeof(string));
        } 
    }
}


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK