LabelLiteral.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / LabelLiteral.cs / 1 / LabelLiteral.cs

                            using System; 
using System.Collections.Generic;
using System.Text;

namespace System.Web.UI.WebControls { 
    // Used in the login controls for accessibility
    internal sealed class LabelLiteral : Literal { 
        internal Control _for; 
        internal bool _renderAsLabel = false;
 
        internal LabelLiteral(Control forControl) {
            _for = forControl;
        }
 
        internal bool RenderAsLabel {
            get { 
                return _renderAsLabel; 
            }
            set { 
                _renderAsLabel = value;
            }
        }
 
        protected internal override void Render(HtmlTextWriter writer) {
            // Render as a label in designer for accessibility 
            if (RenderAsLabel) { 
                // Total hack for accessibility of labels for login controls!
                writer.Write(""); 
                writer.Write(Text);
                writer.Write(""); 
            } 
            else {
                writer.AddAttribute(HtmlTextWriterAttribute.For, _for.ClientID); 
                writer.RenderBeginTag(HtmlTextWriterTag.Label);
                base.Render(writer);
                writer.RenderEndTag();
            } 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System; 
using System.Collections.Generic;
using System.Text;

namespace System.Web.UI.WebControls { 
    // Used in the login controls for accessibility
    internal sealed class LabelLiteral : Literal { 
        internal Control _for; 
        internal bool _renderAsLabel = false;
 
        internal LabelLiteral(Control forControl) {
            _for = forControl;
        }
 
        internal bool RenderAsLabel {
            get { 
                return _renderAsLabel; 
            }
            set { 
                _renderAsLabel = value;
            }
        }
 
        protected internal override void Render(HtmlTextWriter writer) {
            // Render as a label in designer for accessibility 
            if (RenderAsLabel) { 
                // Total hack for accessibility of labels for login controls!
                writer.Write(""); 
                writer.Write(Text);
                writer.Write(""); 
            } 
            else {
                writer.AddAttribute(HtmlTextWriterAttribute.For, _for.ClientID); 
                writer.RenderBeginTag(HtmlTextWriterTag.Label);
                base.Render(writer);
                writer.RenderEndTag();
            } 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

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