Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / Label.cs / 1 / Label.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Drawing.Design; using System.Security.Permissions; using System.Web; using System.Web.UI; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class LabelControlBuilder : ControlBuilder { ///Interacts with the parser to build a ///control. /// /// public override bool AllowWhitespaceLiterals() { return false; } } ///Specifies whether white space literals are allowed. ////// [ ControlBuilderAttribute(typeof(LabelControlBuilder)), ControlValueProperty("Text"), DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + AssemblyRef.SystemDesign), DefaultProperty("Text"), ParseChildren(false), Designer("System.Web.UI.Design.WebControls.LabelDesigner, " + AssemblyRef.SystemDesign), ToolboxData("<{0}:Label runat=\"server\" Text=\"Label\">{0}:Label>") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class Label : WebControl, ITextControl { ///Constructs a label for displaying text programmatcially on a /// page. ////// public Label() { } ///Initializes a new instance of the ///class and renders /// it as a SPAN tag. /// internal Label(HtmlTextWriterTag tag) : base(tag) { } ////// [ DefaultValue(""), IDReferenceProperty(), TypeConverter(typeof(AssociatedControlConverter)), WebCategory("Accessibility"), WebSysDescription(SR.Label_AssociatedControlID), Themeable(false) ] public virtual string AssociatedControlID { get { string s = (string)ViewState["AssociatedControlID"]; return (s == null) ? String.Empty : s; } set { ViewState["AssociatedControlID"] = value; } } internal bool AssociatedControlInControlTree { get { object o = ViewState["AssociatedControlNotInControlTree"]; return (o == null ? true : (bool)o); } set { ViewState["AssociatedControlNotInControlTree"] = value; } } internal override bool RequiresLegacyRendering { get { return true; } } protected override HtmlTextWriterTag TagKey { get { if (AssociatedControlID.Length != 0) { return HtmlTextWriterTag.Label; } return base.TagKey; } } ///[To be supplied.] ////// [ Localizable(true), Bindable(true), WebCategory("Appearance"), DefaultValue(""), WebSysDescription(SR.Label_Text), PersistenceMode(PersistenceMode.InnerDefaultProperty) ] public virtual string Text { get { object o = ViewState["Text"]; return((o == null) ? String.Empty : (string)o); } set { if (HasControls()) { Controls.Clear(); } ViewState["Text"] = value; } } protected override void AddAttributesToRender(HtmlTextWriter writer) { string associatedControlID = AssociatedControlID; if (associatedControlID.Length != 0) { if (AssociatedControlInControlTree) { Control wc = FindControl(associatedControlID); if (wc == null) { // Don't throw in the designer. if (!DesignMode) throw new HttpException(SR.GetString(SR.LabelForNotFound, associatedControlID, ID)); } else { writer.AddAttribute(HtmlTextWriterAttribute.For, wc.ClientID); } } else { writer.AddAttribute(HtmlTextWriterAttribute.For, associatedControlID); } } base.AddAttributesToRender(writer); } ///Gets or sets the text content of the ////// control. /// /// protected override void AddParsedSubObject(object obj) { if (HasControls()) { base.AddParsedSubObject(obj); } else { if (obj is LiteralControl) { Text = ((LiteralControl)obj).Text; } else { string currentText = Text; if (currentText.Length != 0) { Text = String.Empty; base.AddParsedSubObject(new LiteralControl(currentText)); } base.AddParsedSubObject(obj); } } } ////// /// protected override void LoadViewState(object savedState) { if (savedState != null) { base.LoadViewState(savedState); string s = (string)ViewState["Text"]; if (s != null) Text = s; } } ///Load previously saved state. /// Overridden to synchronize Text property with LiteralContent. ////// /// protected internal override void RenderContents(HtmlTextWriter writer) { if (HasRenderingData()) { base.RenderContents(writer); } else { writer.Write(Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //Renders the contents of the ///into the specified writer. // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Drawing.Design; using System.Security.Permissions; using System.Web; using System.Web.UI; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class LabelControlBuilder : ControlBuilder { ///Interacts with the parser to build a ///control. /// /// public override bool AllowWhitespaceLiterals() { return false; } } ///Specifies whether white space literals are allowed. ////// [ ControlBuilderAttribute(typeof(LabelControlBuilder)), ControlValueProperty("Text"), DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + AssemblyRef.SystemDesign), DefaultProperty("Text"), ParseChildren(false), Designer("System.Web.UI.Design.WebControls.LabelDesigner, " + AssemblyRef.SystemDesign), ToolboxData("<{0}:Label runat=\"server\" Text=\"Label\">{0}:Label>") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class Label : WebControl, ITextControl { ///Constructs a label for displaying text programmatcially on a /// page. ////// public Label() { } ///Initializes a new instance of the ///class and renders /// it as a SPAN tag. /// internal Label(HtmlTextWriterTag tag) : base(tag) { } ////// [ DefaultValue(""), IDReferenceProperty(), TypeConverter(typeof(AssociatedControlConverter)), WebCategory("Accessibility"), WebSysDescription(SR.Label_AssociatedControlID), Themeable(false) ] public virtual string AssociatedControlID { get { string s = (string)ViewState["AssociatedControlID"]; return (s == null) ? String.Empty : s; } set { ViewState["AssociatedControlID"] = value; } } internal bool AssociatedControlInControlTree { get { object o = ViewState["AssociatedControlNotInControlTree"]; return (o == null ? true : (bool)o); } set { ViewState["AssociatedControlNotInControlTree"] = value; } } internal override bool RequiresLegacyRendering { get { return true; } } protected override HtmlTextWriterTag TagKey { get { if (AssociatedControlID.Length != 0) { return HtmlTextWriterTag.Label; } return base.TagKey; } } ///[To be supplied.] ////// [ Localizable(true), Bindable(true), WebCategory("Appearance"), DefaultValue(""), WebSysDescription(SR.Label_Text), PersistenceMode(PersistenceMode.InnerDefaultProperty) ] public virtual string Text { get { object o = ViewState["Text"]; return((o == null) ? String.Empty : (string)o); } set { if (HasControls()) { Controls.Clear(); } ViewState["Text"] = value; } } protected override void AddAttributesToRender(HtmlTextWriter writer) { string associatedControlID = AssociatedControlID; if (associatedControlID.Length != 0) { if (AssociatedControlInControlTree) { Control wc = FindControl(associatedControlID); if (wc == null) { // Don't throw in the designer. if (!DesignMode) throw new HttpException(SR.GetString(SR.LabelForNotFound, associatedControlID, ID)); } else { writer.AddAttribute(HtmlTextWriterAttribute.For, wc.ClientID); } } else { writer.AddAttribute(HtmlTextWriterAttribute.For, associatedControlID); } } base.AddAttributesToRender(writer); } ///Gets or sets the text content of the ////// control. /// /// protected override void AddParsedSubObject(object obj) { if (HasControls()) { base.AddParsedSubObject(obj); } else { if (obj is LiteralControl) { Text = ((LiteralControl)obj).Text; } else { string currentText = Text; if (currentText.Length != 0) { Text = String.Empty; base.AddParsedSubObject(new LiteralControl(currentText)); } base.AddParsedSubObject(obj); } } } ////// /// protected override void LoadViewState(object savedState) { if (savedState != null) { base.LoadViewState(savedState); string s = (string)ViewState["Text"]; if (s != null) Text = s; } } ///Load previously saved state. /// Overridden to synchronize Text property with LiteralContent. ////// /// protected internal override void RenderContents(HtmlTextWriter writer) { if (HasRenderingData()) { base.RenderContents(writer); } else { writer.Write(Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Renders the contents of the ///into the specified writer.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Page.cs
- UniqueConstraint.cs
- RevocationPoint.cs
- ClientRuntimeConfig.cs
- TemplateControlParser.cs
- ClientTarget.cs
- Bits.cs
- XmlSchemaAnnotated.cs
- Invariant.cs
- SimpleTableProvider.cs
- Mappings.cs
- Psha1DerivedKeyGenerator.cs
- ExpressionList.cs
- UnsafeNativeMethods.cs
- ClipboardProcessor.cs
- UshortList2.cs
- ApplicationCommands.cs
- ListArgumentProvider.cs
- ArraySet.cs
- DataBoundControl.cs
- CuspData.cs
- WebPartMovingEventArgs.cs
- PageSettings.cs
- RenderOptions.cs
- InternalDispatchObject.cs
- Command.cs
- BoundField.cs
- AssociativeAggregationOperator.cs
- ListViewItemMouseHoverEvent.cs
- TraceLog.cs
- HttpResponseHeader.cs
- CTreeGenerator.cs
- ContentHostHelper.cs
- HyperLinkColumn.cs
- FreezableDefaultValueFactory.cs
- ObjectCloneHelper.cs
- ProcessingInstructionAction.cs
- CDSCollectionETWBCLProvider.cs
- SchemaImporterExtensionsSection.cs
- OracleBinary.cs
- TreeIterator.cs
- CompilerCollection.cs
- RectValueSerializer.cs
- DataTableExtensions.cs
- DateBoldEvent.cs
- ListSourceHelper.cs
- KnownTypesProvider.cs
- SoapElementAttribute.cs
- DetailsViewPagerRow.cs
- EventLogLink.cs
- WebServiceEnumData.cs
- Selector.cs
- CodeTypeParameterCollection.cs
- DoubleLink.cs
- SafeNativeMethodsMilCoreApi.cs
- ListenerSingletonConnectionReader.cs
- GPStream.cs
- CategoryGridEntry.cs
- XmlAttribute.cs
- SelectionPatternIdentifiers.cs
- TagNameToTypeMapper.cs
- HttpCachePolicyElement.cs
- SmtpMail.cs
- EpmSyndicationContentSerializer.cs
- SecurityDescriptor.cs
- DefaultEvaluationContext.cs
- SQLDouble.cs
- CollectionType.cs
- ChildTable.cs
- SplayTreeNode.cs
- XmlException.cs
- RegexGroup.cs
- PropertyEmitter.cs
- TextTreeUndoUnit.cs
- ClientTarget.cs
- TreeNodeEventArgs.cs
- Content.cs
- BroadcastEventHelper.cs
- HttpRequestCacheValidator.cs
- BoolLiteral.cs
- MemberInitExpression.cs
- Double.cs
- ForwardPositionQuery.cs
- PieceDirectory.cs
- ColorTransformHelper.cs
- ConfigurationPropertyCollection.cs
- precedingquery.cs
- DesignTimeVisibleAttribute.cs
- DataBinding.cs
- WebBrowserProgressChangedEventHandler.cs
- GridViewUpdateEventArgs.cs
- TransformConverter.cs
- AutoGeneratedFieldProperties.cs
- ToolStripCodeDomSerializer.cs
- ScriptServiceAttribute.cs
- CodePageEncoding.cs
- AuthorizationRule.cs
- FixedPageProcessor.cs
- WinInetCache.cs
- ConfigurationSection.cs