Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / HtmlControls / HtmlContainerControl.cs / 1 / HtmlContainerControl.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.HtmlControls { using System.Runtime.Serialization.Formatters; using System; using System.Collections; using System.ComponentModel; using System.IO; using System.Web.UI; using System.Security.Permissions; /* * A control representing an intrinsic Html tag. */ ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] abstract public class HtmlContainerControl : HtmlControl { /* * Creates a new WebControl */ ///The ////// class defines the methods, /// properties and events /// available to all Html Server controls that must have a /// closing tag. /// protected HtmlContainerControl() : this("span") { } /* * Creates a new HtmlContainerControl */ ///Initializes a new instance of a ///class using /// default values. /// public HtmlContainerControl(string tag) : base(tag) { } /* * The inner html content between the begin and end tag. * A set will replace any existing child controls with a single literal. * A get will return the text of a single literal child OR * will throw an exception if there are no children, more than one * child, or the single child is not a literal. */ ///Initializes a new instance of a ///class using the /// specified string. /// [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), HtmlControlPersistable(false), ] public virtual string InnerHtml { get { if (IsLiteralContent()) return((LiteralControl) Controls[0]).Text; else if (HasControls() && (Controls.Count == 1) && Controls[0] is DataBoundLiteralControl) return ((DataBoundLiteralControl) Controls[0]).Text; else { if (Controls.Count == 0) return String.Empty; throw new HttpException(SR.GetString(SR.Inner_Content_not_literal, ID)); } } set { Controls.Clear(); Controls.Add(new LiteralControl(value)); ViewState["innerhtml"] = value; } } /* * The inner text content between the begin and end tag. * A set will replace any existing child controls with a single literal. * A get will return the text of a single literal child OR * will throw an exception if there are no children, more than one child, or * the single child is not a literal. */ ////// Gets or sets the /// content found between the opening and closing tags of the specified HTML server control. /// ////// [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), HtmlControlPersistable(false), ] public virtual string InnerText { get { return HttpUtility.HtmlDecode(InnerHtml); } set { InnerHtml = HttpUtility.HtmlEncode(value); } } ////// Gets or sets all text between the opening and closing tags /// of the specified HTML server control. /// ////// protected override ControlCollection CreateControlCollection() { return new ControlCollection(this); } ///[To be supplied.] ////// /// protected override void LoadViewState(object savedState) { if (savedState != null) { base.LoadViewState(savedState); string s = (string)ViewState["innerhtml"]; if (s != null) InnerHtml = s; } } /* * Render the control into the given writer. */ ////// /// protected internal override void Render(HtmlTextWriter writer) { RenderBeginTag(writer); RenderChildren(writer); RenderEndTag(writer); } /* * Override to prevent InnerHtml from being rendered as an attribute. */ ////// /// protected override void RenderAttributes(HtmlTextWriter writer) { ViewState.Remove("innerhtml"); base.RenderAttributes(writer); } /* * Render the end tag, </TAGNAME>. */ ////// /// protected virtual void RenderEndTag(HtmlTextWriter writer) { writer.WriteEndTag(TagName); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StoragePropertyMapping.cs
- RegexGroupCollection.cs
- SelectedDatesCollection.cs
- OperationDescriptionCollection.cs
- SchemaType.cs
- EntityTransaction.cs
- HttpHandlersInstallComponent.cs
- ExternalCalls.cs
- BaseAddressPrefixFilterElement.cs
- WindowsFormsSynchronizationContext.cs
- LinqDataSourceUpdateEventArgs.cs
- IteratorDescriptor.cs
- Translator.cs
- CalendarTable.cs
- MessageQueueException.cs
- ScriptingJsonSerializationSection.cs
- mediaeventargs.cs
- PostBackOptions.cs
- QueryResultOp.cs
- MissingSatelliteAssemblyException.cs
- RemoteWebConfigurationHostStream.cs
- CharConverter.cs
- BuildProvidersCompiler.cs
- NetworkAddressChange.cs
- CreateParams.cs
- ConnectionPointCookie.cs
- DynamicResourceExtensionConverter.cs
- NamespaceDecl.cs
- FormsIdentity.cs
- DbConnectionPoolCounters.cs
- WebEventCodes.cs
- RelationshipDetailsRow.cs
- DataGridViewCellValueEventArgs.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ImageDrawing.cs
- ISAPIWorkerRequest.cs
- XmlQueryRuntime.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SaveFileDialog.cs
- DataServiceQueryException.cs
- CapabilitiesPattern.cs
- RegexMatchCollection.cs
- BasicKeyConstraint.cs
- OdbcConnectionPoolProviderInfo.cs
- Funcletizer.cs
- ProxyGenerator.cs
- MessageLoggingElement.cs
- HtmlButton.cs
- ObjectSet.cs
- TextProviderWrapper.cs
- ReadOnlyHierarchicalDataSource.cs
- StylusPointProperties.cs
- XmlSignatureManifest.cs
- VirtualDirectoryMappingCollection.cs
- HybridDictionary.cs
- CapabilitiesSection.cs
- ElementHostPropertyMap.cs
- UpnEndpointIdentity.cs
- SoapHeader.cs
- TextEffectResolver.cs
- SerializationStore.cs
- AdapterUtil.cs
- ThreadAbortException.cs
- TypeDependencyAttribute.cs
- IdentitySection.cs
- DesignerSerializerAttribute.cs
- HistoryEventArgs.cs
- Int64KeyFrameCollection.cs
- SymbolType.cs
- EnumerableCollectionView.cs
- DbProviderFactories.cs
- UIServiceHelper.cs
- ContentPosition.cs
- FileAuthorizationModule.cs
- XmlAnyElementAttribute.cs
- NativeMethods.cs
- XmlAtomicValue.cs
- PresentationTraceSources.cs
- mediaeventshelper.cs
- ListArgumentProvider.cs
- PointConverter.cs
- CellConstant.cs
- XmlSchemaGroupRef.cs
- UrlPath.cs
- FormViewInsertedEventArgs.cs
- CngKeyCreationParameters.cs
- PolyLineSegmentFigureLogic.cs
- ConnectionStringsExpressionBuilder.cs
- OracleBoolean.cs
- ThreadTrace.cs
- UnsafeNativeMethods.cs
- ConfigurationElementCollection.cs
- CryptoConfig.cs
- EntityProviderFactory.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- DefaultHttpHandler.cs
- BooleanKeyFrameCollection.cs
- ConfigPathUtility.cs
- BidirectionalDictionary.cs
- StorageMappingItemLoader.cs