Code:
/ FX-1434 / FX-1434 / 1.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
- NameSpaceExtractor.cs
- ValidatedControlConverter.cs
- AsyncCompletedEventArgs.cs
- DispatchWrapper.cs
- BamlReader.cs
- SQLInt16Storage.cs
- DiagnosticStrings.cs
- Base64Decoder.cs
- PeerTransportListenAddressConverter.cs
- WebSysDescriptionAttribute.cs
- JsonFormatGeneratorStatics.cs
- MetadataUtil.cs
- CertificateElement.cs
- Pkcs9Attribute.cs
- RequestCachePolicyConverter.cs
- WeakReadOnlyCollection.cs
- AttributeData.cs
- SQLMoneyStorage.cs
- BaseConfigurationRecord.cs
- ParserStreamGeometryContext.cs
- RoutedUICommand.cs
- EmptyStringExpandableObjectConverter.cs
- EditorBrowsableAttribute.cs
- DbSetClause.cs
- PackageFilter.cs
- DataControlFieldCell.cs
- PropertyGeneratedEventArgs.cs
- EdmEntityTypeAttribute.cs
- BitmapScalingModeValidation.cs
- WindowsTokenRoleProvider.cs
- HwndSource.cs
- ImageListUtils.cs
- StateDesigner.Layouts.cs
- VariableQuery.cs
- NullableLongAverageAggregationOperator.cs
- precedingsibling.cs
- ArglessEventHandlerProxy.cs
- ObjectKeyFrameCollection.cs
- XamlSerializer.cs
- RecordManager.cs
- infer.cs
- PingReply.cs
- UTF8Encoding.cs
- TextBox.cs
- NoResizeSelectionBorderGlyph.cs
- DefaultClaimSet.cs
- MD5CryptoServiceProvider.cs
- WindowsScrollBar.cs
- OutputScopeManager.cs
- Registry.cs
- MediaPlayerState.cs
- CombinedGeometry.cs
- KerberosSecurityTokenProvider.cs
- BamlTreeUpdater.cs
- CollectionViewGroup.cs
- XmlnsDefinitionAttribute.cs
- ListBoxDesigner.cs
- TransformerTypeCollection.cs
- SHA512.cs
- WindowsTooltip.cs
- XPathNavigatorKeyComparer.cs
- MulticastOption.cs
- InvalidAsynchronousStateException.cs
- StandardToolWindows.cs
- XmlSchemaRedefine.cs
- ApplicationHost.cs
- SiteMapHierarchicalDataSourceView.cs
- WebPartMinimizeVerb.cs
- BufferModesCollection.cs
- OutputCacheProfileCollection.cs
- RegexRunner.cs
- DocumentXmlWriter.cs
- LinqDataSourceEditData.cs
- FixedSOMTableRow.cs
- UserControl.cs
- CriticalFinalizerObject.cs
- DiscoveryClientProtocol.cs
- ButtonRenderer.cs
- UInt64Storage.cs
- UserControlBuildProvider.cs
- WindowsContainer.cs
- PipeStream.cs
- IndicCharClassifier.cs
- NamespaceEmitter.cs
- DataColumnMapping.cs
- QueryStringParameter.cs
- VirtualizingPanel.cs
- AppDomainManager.cs
- StrongNameKeyPair.cs
- AutomationIdentifier.cs
- Ref.cs
- UriTemplateDispatchFormatter.cs
- Helper.cs
- SmiRecordBuffer.cs
- DataSourceHelper.cs
- MsmqInputChannel.cs
- AppDomainAttributes.cs
- TextPenaltyModule.cs
- PagerSettings.cs
- EnumerableValidator.cs