Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebParts / DesignerWebPartChrome.cs / 1 / DesignerWebPartChrome.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.WebControls.WebParts { using System.Design; using System.Globalization; using System.IO; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; ////// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal class DesignerWebPartChrome : WebPartChrome { private ViewRendering _partViewRendering; public DesignerWebPartChrome(WebPartZoneBase zone) : base(zone, null) { } public ViewRendering GetViewRendering(Control control) { string designTimeHtml; DesignerRegionCollection regions; try { _partViewRendering = ControlDesigner.GetViewRendering(control); regions = _partViewRendering.Regions; WebPart webPart = control as WebPart; if (webPart == null) { // We should not reparent the control, so we must use the DesignerGenericWebPart instead // of the regular GenericWebPart. // Pass in the ViewControl instead of the Control, so that design-time themes are // reflected in the Chrome rendering webPart = new DesignerGenericWebPart(PartDesigner.GetViewControl(control)); } StringWriter innerWriter = new StringWriter(CultureInfo.InvariantCulture); // Pass in the ViewControl instead of the WebPart, so that design-time themes are // reflected in the Chrome rendering RenderWebPart(new DesignTimeHtmlTextWriter(innerWriter), (WebPart)PartDesigner.GetViewControl(webPart)); designTimeHtml = innerWriter.ToString(); } catch (Exception e) { designTimeHtml = ControlDesigner.CreateErrorDesignTimeHtml( SR.GetString(SR.ControlDesigner_UnhandledException), e, control); regions = new DesignerRegionCollection(); } StringWriter writer = new StringWriter(CultureInfo.InvariantCulture); DesignTimeHtmlTextWriter htmlTextWriter = new DesignTimeHtmlTextWriter(writer); bool horizontal = (Zone.LayoutOrientation == Orientation.Horizontal); if (horizontal) { htmlTextWriter.AddStyleAttribute("display", "inline-block"); htmlTextWriter.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%"); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Span); } htmlTextWriter.Write(designTimeHtml); if (horizontal) { htmlTextWriter.RenderEndTag(); } return new ViewRendering(writer.ToString(), regions); } protected override void RenderPartContents(HtmlTextWriter writer, WebPart webPart) { writer.Write(_partViewRendering.Content); } } } // 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
- TagPrefixAttribute.cs
- FragmentQuery.cs
- ToolStripItemBehavior.cs
- ModelEditingScope.cs
- SingleAnimationUsingKeyFrames.cs
- WebSysDisplayNameAttribute.cs
- TypeReference.cs
- DataControlFieldCell.cs
- DesignerOptionService.cs
- ProfileEventArgs.cs
- SqlServer2KCompatibilityAnnotation.cs
- OneOf.cs
- CaseInsensitiveHashCodeProvider.cs
- FontFamily.cs
- EntryIndex.cs
- DbProviderSpecificTypePropertyAttribute.cs
- StylusEditingBehavior.cs
- XmlEventCache.cs
- NativeRightsManagementAPIsStructures.cs
- ButtonFlatAdapter.cs
- WebPartDescriptionCollection.cs
- QilScopedVisitor.cs
- Fx.cs
- _HTTPDateParse.cs
- SolidBrush.cs
- XmlBoundElement.cs
- RadioButtonList.cs
- OleDbCommand.cs
- XomlCompilerHelpers.cs
- FontSource.cs
- PersonalizationEntry.cs
- RadialGradientBrush.cs
- EnvelopedPkcs7.cs
- NamespaceMapping.cs
- ExtendedPropertyInfo.cs
- PropertyEmitterBase.cs
- QilUnary.cs
- SemaphoreSecurity.cs
- MessageSecurityOverTcpElement.cs
- PageAsyncTask.cs
- Validator.cs
- StringReader.cs
- ChannelSinkStacks.cs
- CatalogPartChrome.cs
- UdpReplyToBehavior.cs
- XmlDomTextWriter.cs
- ObjectDataSourceMethodEventArgs.cs
- DefaultWorkflowSchedulerService.cs
- PageThemeBuildProvider.cs
- ConfigurationLocation.cs
- XmlSchemaSimpleContent.cs
- DefaultBindingPropertyAttribute.cs
- InputLangChangeRequestEvent.cs
- DockPattern.cs
- RemoteCryptoTokenProvider.cs
- XmlSchemaIdentityConstraint.cs
- Translator.cs
- AppDomainShutdownMonitor.cs
- ContentPlaceHolderDesigner.cs
- MailWebEventProvider.cs
- AppDomainFactory.cs
- Pkcs7Recipient.cs
- TableRowGroup.cs
- IndexingContentUnit.cs
- DelegateSerializationHolder.cs
- BackoffTimeoutHelper.cs
- ClassicBorderDecorator.cs
- DeploymentExceptionMapper.cs
- ExtendedPropertyCollection.cs
- SHA1Managed.cs
- EpmSyndicationContentSerializer.cs
- LocatorPartList.cs
- OleDbParameterCollection.cs
- HttpHandlerActionCollection.cs
- SmtpFailedRecipientException.cs
- ObservableCollection.cs
- PkcsUtils.cs
- InternalPolicyElement.cs
- WpfXamlLoader.cs
- EncoderNLS.cs
- Win32SafeHandles.cs
- CipherData.cs
- UInt32Converter.cs
- GridViewPageEventArgs.cs
- Brush.cs
- HtmlInputControl.cs
- UpdateCommand.cs
- MetaModel.cs
- SoapIgnoreAttribute.cs
- ScrollViewerAutomationPeer.cs
- HttpDebugHandler.cs
- ColumnCollectionEditor.cs
- ClientCultureInfo.cs
- UnwrappedTypesXmlSerializerManager.cs
- MethodExpr.cs
- EmptyEnumerator.cs
- ErrorHandler.cs
- Scheduling.cs
- FormatterConverter.cs
- TranslateTransform.cs