Code:
/ FX-1434 / FX-1434 / 1.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
- PromptBuilder.cs
- ResourceSetExpression.cs
- SharedConnectionListener.cs
- _PooledStream.cs
- XmlSchemaSimpleTypeUnion.cs
- DispatcherSynchronizationContext.cs
- Light.cs
- ServiceObjectContainer.cs
- EntityDataSourceEntitySetNameItem.cs
- CompilerWrapper.cs
- DescendantOverDescendantQuery.cs
- BamlTreeUpdater.cs
- SqlFileStream.cs
- ExpressionTextBoxAutomationPeer.cs
- DeadCharTextComposition.cs
- PresentationAppDomainManager.cs
- TypedTableGenerator.cs
- DeclaredTypeElementCollection.cs
- FieldBuilder.cs
- Bold.cs
- DBDataPermission.cs
- AutomationPropertyInfo.cs
- DecoderFallback.cs
- ConfigurationLocationCollection.cs
- ToolStripGrip.cs
- Processor.cs
- CodeRemoveEventStatement.cs
- UntypedNullExpression.cs
- FunctionDetailsReader.cs
- Set.cs
- TrailingSpaceComparer.cs
- PackWebResponse.cs
- WSSecurityPolicy11.cs
- PersonalizationProviderCollection.cs
- ScrollItemPatternIdentifiers.cs
- securitycriticaldata.cs
- SQLSingleStorage.cs
- GAC.cs
- TargetFrameworkAttribute.cs
- EntityContainerEntitySetDefiningQuery.cs
- DescendantOverDescendantQuery.cs
- Animatable.cs
- XmlSchemaAttributeGroup.cs
- LicenseProviderAttribute.cs
- CustomError.cs
- DetailsViewDeleteEventArgs.cs
- LowerCaseStringConverter.cs
- SerialPort.cs
- ValidatingPropertiesEventArgs.cs
- FormsAuthenticationConfiguration.cs
- FontResourceCache.cs
- XamlFigureLengthSerializer.cs
- RelationshipManager.cs
- StreamHelper.cs
- EncoderExceptionFallback.cs
- URLString.cs
- MeasureData.cs
- PolicyLevel.cs
- ControlPropertyNameConverter.cs
- CallbackValidatorAttribute.cs
- ListViewItem.cs
- ProtectedUri.cs
- LinqDataSourceHelper.cs
- PaintEvent.cs
- WS2007HttpBindingElement.cs
- PropertyValueChangedEvent.cs
- DataGridSortCommandEventArgs.cs
- CompressionTransform.cs
- CharKeyFrameCollection.cs
- MdiWindowListItemConverter.cs
- XmlSerializationWriter.cs
- WebPartConnectionsCloseVerb.cs
- PackageRelationshipSelector.cs
- ResourceType.cs
- mediaeventshelper.cs
- RuleSetDialog.Designer.cs
- ErrorTableItemStyle.cs
- PageParserFilter.cs
- WebPartZoneCollection.cs
- TemplateBaseAction.cs
- XmlHierarchyData.cs
- ThreadSafeList.cs
- LinearGradientBrush.cs
- ExtendedPropertyCollection.cs
- EditorPartChrome.cs
- ListChangedEventArgs.cs
- selecteditemcollection.cs
- UnsafeNativeMethods.cs
- CommandLibraryHelper.cs
- InProcStateClientManager.cs
- FilterableAttribute.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- HttpFileCollectionBase.cs
- GeometryDrawing.cs
- ReferenceService.cs
- IdleTimeoutMonitor.cs
- NativeCompoundFileAPIs.cs
- HttpListenerRequest.cs
- WindowInteractionStateTracker.cs
- QuaternionKeyFrameCollection.cs