Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ui / ScriptControl.cs / 1 / ScriptControl.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.Resources; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Util; [ AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), ] public abstract class ScriptControl : WebControl, IScriptControl { private IScriptManagerInternal _scriptManager; private new IPage _page; protected ScriptControl() { } internal ScriptControl(IScriptManagerInternal scriptManager, IPage page) { _scriptManager = scriptManager; _page = page; } private IPage IPage { get { if (_page != null) { return _page; } else { Page page = Page; if (page == null) { throw new InvalidOperationException(AtlasWeb.Common_PageCannotBeNull); } return new PageWrapper(page); } } } private IScriptManagerInternal ScriptManager { get { if (_scriptManager == null) { Page page = Page; if (page == null) { throw new InvalidOperationException(AtlasWeb.Common_PageCannotBeNull); } _scriptManager = System.Web.UI.ScriptManager.GetCurrent(page); if (_scriptManager == null) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, AtlasWeb.Common_ScriptManagerRequired, ID)); } } return _scriptManager; } } [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] protected internal override void OnPreRender(EventArgs e) { base.OnPreRender(e); ScriptManager.RegisterScriptControl(this); } protected internal override void Render(HtmlTextWriter writer) { base.Render(writer); // DevDiv 97460: ScriptDescriptors only render if in server form, verify to avoid silently failing. IPage.VerifyRenderingInServerForm(this); // ScriptManager cannot be found in DesignMode, so do not attempt to register scripts. if (!DesignMode) { ScriptManager.RegisterScriptDescriptors(this); } } [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Implementation will likely return a new collection, which is too slow for a property")] protected abstract IEnumerableGetScriptDescriptors(); [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Implementation will likely return a new collection, which is too slow for a property")] protected abstract IEnumerable GetScriptReferences(); #region IScriptControl Members IEnumerable IScriptControl.GetScriptDescriptors() { return GetScriptDescriptors(); } IEnumerable IScriptControl.GetScriptReferences() { return GetScriptReferences(); } #endregion } } // 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
- cookieexception.cs
- DataTableTypeConverter.cs
- X509Logo.cs
- TimelineCollection.cs
- FixUpCollection.cs
- UserPreferenceChangingEventArgs.cs
- ByteStream.cs
- WSSecurityTokenSerializer.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- HttpRequest.cs
- GPRECT.cs
- GroupItemAutomationPeer.cs
- XslVisitor.cs
- TextBoxAutoCompleteSourceConverter.cs
- CompressStream.cs
- BitmapEffectGroup.cs
- DataBoundControlAdapter.cs
- InputDevice.cs
- ProjectedSlot.cs
- StreamGeometry.cs
- GenericWebPart.cs
- PersonalizationAdministration.cs
- TextViewBase.cs
- EmptyEnumerable.cs
- TypeSystem.cs
- CodeSubDirectory.cs
- DataFieldCollectionEditor.cs
- WsiProfilesElement.cs
- Resources.Designer.cs
- GroupStyle.cs
- OdbcInfoMessageEvent.cs
- FlowDocumentPaginator.cs
- EncodingNLS.cs
- SystemColors.cs
- ComponentCollection.cs
- TreeViewDesigner.cs
- RoleGroupCollection.cs
- OutputCacheProfileCollection.cs
- ServiceObjectContainer.cs
- CallContext.cs
- ProviderIncompatibleException.cs
- FileUtil.cs
- GuidelineSet.cs
- FloatMinMaxAggregationOperator.cs
- SystemWebCachingSectionGroup.cs
- ArrangedElementCollection.cs
- ValidationError.cs
- DataComponentNameHandler.cs
- DeferredReference.cs
- _BufferOffsetSize.cs
- TraceHandlerErrorFormatter.cs
- TextWriter.cs
- XmlSecureResolver.cs
- ChangesetResponse.cs
- CodeValidator.cs
- ExeContext.cs
- ImageListStreamer.cs
- exports.cs
- RectangleGeometry.cs
- CommonGetThemePartSize.cs
- ThousandthOfEmRealPoints.cs
- SymmetricKeyWrap.cs
- IndexOutOfRangeException.cs
- VirtualPathUtility.cs
- DataGridViewImageColumn.cs
- DiagnosticTraceSchemas.cs
- GlobalItem.cs
- Rect3DValueSerializer.cs
- EpmCustomContentDeSerializer.cs
- Typography.cs
- DropDownList.cs
- ScriptingScriptResourceHandlerSection.cs
- SystemColorTracker.cs
- UInt64Storage.cs
- ClientSponsor.cs
- UrlAuthFailedErrorFormatter.cs
- TransformerConfigurationWizardBase.cs
- EntityDesignPluralizationHandler.cs
- AppDomainUnloadedException.cs
- XmlBindingWorker.cs
- DataObjectSettingDataEventArgs.cs
- SignedXml.cs
- X509IssuerSerialKeyIdentifierClause.cs
- PriorityRange.cs
- XmlAttributeHolder.cs
- ThreadExceptionEvent.cs
- TextContainerChangeEventArgs.cs
- ResolveCriteriaApril2005.cs
- MaskedTextBox.cs
- TextBox.cs
- cryptoapiTransform.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- DataListGeneralPage.cs
- CodeDOMUtility.cs
- SqlTriggerContext.cs
- ValueTypeFixupInfo.cs
- DataKeyCollection.cs
- ColorBuilder.cs
- UIElement3D.cs
- _LoggingObject.cs