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
- ConnectionsZone.cs
- TypeReference.cs
- _UriTypeConverter.cs
- HtmlControlPersistable.cs
- DataGridViewLayoutData.cs
- DynamicPropertyReader.cs
- KeyboardEventArgs.cs
- ModuleElement.cs
- SerialStream.cs
- RegexReplacement.cs
- GeneratedContractType.cs
- InvokeWebServiceDesigner.cs
- UInt16.cs
- JavascriptCallbackBehaviorAttribute.cs
- Grant.cs
- RoutedEventHandlerInfo.cs
- MenuStrip.cs
- PkcsUtils.cs
- GreenMethods.cs
- SqlTopReducer.cs
- SessionEndingEventArgs.cs
- TypeDelegator.cs
- ManifestResourceInfo.cs
- DesignColumn.cs
- DefaultParameterValueAttribute.cs
- coordinatorscratchpad.cs
- UrlAuthFailureHandler.cs
- GridViewSelectEventArgs.cs
- DragCompletedEventArgs.cs
- BitmapEffectGeneralTransform.cs
- SupportingTokenBindingElement.cs
- CollectionConverter.cs
- PartialList.cs
- BamlLocalizer.cs
- TextSelectionHelper.cs
- RootDesignerSerializerAttribute.cs
- SelectedGridItemChangedEvent.cs
- AdPostCacheSubstitution.cs
- TextSyndicationContentKindHelper.cs
- TargetPerspective.cs
- ToolStripManager.cs
- safex509handles.cs
- FlowNode.cs
- ImageDrawing.cs
- XmlSerializationReader.cs
- ExceptionRoutedEventArgs.cs
- CheckBoxStandardAdapter.cs
- ChtmlPhoneCallAdapter.cs
- MailDefinition.cs
- IWorkflowDebuggerService.cs
- NavigationExpr.cs
- WebServiceEnumData.cs
- PenThreadWorker.cs
- ListControlActionList.cs
- NestedContainer.cs
- CollectionMarkupSerializer.cs
- JsonStringDataContract.cs
- LinqDataSourceValidationException.cs
- LayoutDump.cs
- _SslSessionsCache.cs
- CriticalExceptions.cs
- CookieParameter.cs
- RightsManagementProvider.cs
- OracleInternalConnection.cs
- WindowsIPAddress.cs
- QilNode.cs
- XmlValidatingReaderImpl.cs
- JulianCalendar.cs
- DataGridViewCellStateChangedEventArgs.cs
- StringFormat.cs
- FrameworkPropertyMetadata.cs
- PrintPreviewDialog.cs
- XMLSyntaxException.cs
- GreenMethods.cs
- PanelStyle.cs
- TreeViewImageIndexConverter.cs
- BindingsSection.cs
- TypeInfo.cs
- FieldInfo.cs
- ToolStripContextMenu.cs
- XmlUtil.cs
- HostingEnvironment.cs
- _HelperAsyncResults.cs
- CookieParameter.cs
- ZipQueryOperator.cs
- DependencyPropertyKind.cs
- WindowsTreeView.cs
- SHA384CryptoServiceProvider.cs
- RadioButtonFlatAdapter.cs
- AddInAdapter.cs
- DashStyle.cs
- LayoutEditorPart.cs
- DataGridTablesFactory.cs
- StringAttributeCollection.cs
- HttpValueCollection.cs
- GridItemProviderWrapper.cs
- ContentValidator.cs
- LockedHandleGlyph.cs
- ControlCachePolicy.cs
- ProxyWebPartManager.cs