Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PasswordRecovery.cs
- PrimarySelectionAdorner.cs
- NativeWindow.cs
- xml.cs
- InheritablePropertyChangeInfo.cs
- DeviceFilterDictionary.cs
- AuthenticatedStream.cs
- TransmissionStrategy.cs
- SapiRecoContext.cs
- fixedPageContentExtractor.cs
- LabelLiteral.cs
- DefinitionBase.cs
- EntitySqlQueryBuilder.cs
- AutomationPatternInfo.cs
- BaseAsyncResult.cs
- StringSource.cs
- X509Logo.cs
- HtmlTableRowCollection.cs
- IpcClientManager.cs
- RedistVersionInfo.cs
- PerformanceCounterManager.cs
- BinaryParser.cs
- ApplicationTrust.cs
- SpecialFolderEnumConverter.cs
- ScriptRegistrationManager.cs
- Scheduler.cs
- EnumCodeDomSerializer.cs
- MsmqIntegrationSecurityMode.cs
- EnumerableRowCollectionExtensions.cs
- RouteCollection.cs
- TextWriterTraceListener.cs
- Common.cs
- TextElementAutomationPeer.cs
- Path.cs
- DataSourceGroupCollection.cs
- CorrelationManager.cs
- FixedSOMSemanticBox.cs
- TransactionInformation.cs
- CreatingCookieEventArgs.cs
- CoreSwitches.cs
- WithParamAction.cs
- DataGridViewRowPrePaintEventArgs.cs
- SqlTransaction.cs
- HtmlControlAdapter.cs
- ToolStripItemRenderEventArgs.cs
- LayoutDump.cs
- wmiprovider.cs
- FontFamilyIdentifier.cs
- PropertyMap.cs
- _SafeNetHandles.cs
- CompilerGeneratedAttribute.cs
- Privilege.cs
- CodeDirectoryCompiler.cs
- DependencyObject.cs
- CodeAccessPermission.cs
- CommandHelpers.cs
- GridViewCommandEventArgs.cs
- MobileSysDescriptionAttribute.cs
- ActivityDesignerAccessibleObject.cs
- ImpersonateTokenRef.cs
- IImplicitResourceProvider.cs
- SafeHandle.cs
- XPathBuilder.cs
- ImageListUtils.cs
- MobileListItem.cs
- SecurityUtils.cs
- IpcClientChannel.cs
- CodeIndexerExpression.cs
- TemplateParser.cs
- SiteMapSection.cs
- PrivilegeNotHeldException.cs
- EntityDataSourceState.cs
- TrackBar.cs
- CollectionCodeDomSerializer.cs
- _ListenerAsyncResult.cs
- FullTrustAssemblyCollection.cs
- followingsibling.cs
- OleDbConnectionInternal.cs
- DropTarget.cs
- WebBrowserHelper.cs
- CodeDomExtensionMethods.cs
- ExtenderProvidedPropertyAttribute.cs
- Codec.cs
- DynamicMethod.cs
- SoapCommonClasses.cs
- BaseParser.cs
- TextServicesCompartmentEventSink.cs
- CompensableActivity.cs
- SrgsGrammar.cs
- FeatureSupport.cs
- HtmlInputPassword.cs
- StylusEventArgs.cs
- AuthenticationService.cs
- HwndSourceKeyboardInputSite.cs
- DeviceContexts.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ConcurrentDictionary.cs
- XmlCompatibilityReader.cs
- TreeNodeBindingCollection.cs
- DataGridViewComboBoxEditingControl.cs