Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / TextControlDesigner.cs / 1 / TextControlDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design { using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Globalization; using System.Diagnostics; using System.IO; using System.Reflection; using System.Text; using System.Web.UI; ////// /// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] public class TextControlDesigner : ControlDesigner { ////// This designer can be used for controls which provide a Text property that /// is persisted as inner text. An example of such as control is the /// System.Web.UI.WebControls.Label class. This designer ensures that the /// Text property is set to some default value to ensure design-time visibility /// while preserving the children collection intact. It also ensures correct /// persistence of inner contents in both scenarios: inner text and child controls. /// ///public override string GetDesignTimeHtml() { Control control = ViewControl; PropertyInfo textPropInfo = control.GetType().GetProperty("Text"); string originalText = (string)textPropInfo.GetValue(control, null); bool blank = (originalText == null) || (originalText.Length == 0); bool hasControls = control.HasControls(); Control[] children = null; if (blank) { if (hasControls) { children = new Control[control.Controls.Count]; control.Controls.CopyTo(children, 0); } textPropInfo.SetValue(control, "[" + control.ID + "]", null); } string html; try { html = base.GetDesignTimeHtml(); } finally { if (blank) { textPropInfo.SetValue(control, originalText, null); if (hasControls) { foreach (Control c in children) { control.Controls.Add(c); } } } } return html; } } } // 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
- SQLBinary.cs
- Component.cs
- ObjectTypeMapping.cs
- XmlHierarchicalEnumerable.cs
- SqlCharStream.cs
- xml.cs
- DataGridViewComboBoxColumn.cs
- PartialTrustVisibleAssemblyCollection.cs
- LinearQuaternionKeyFrame.cs
- LazyLoadBehavior.cs
- GeometryModel3D.cs
- AlignmentXValidation.cs
- AuthenticateEventArgs.cs
- ObjectConverter.cs
- BookmarkCallbackWrapper.cs
- Image.cs
- Hex.cs
- Point3DAnimationUsingKeyFrames.cs
- StringCollection.cs
- PhysicalFontFamily.cs
- SetStateDesigner.cs
- ExpandableObjectConverter.cs
- GatewayIPAddressInformationCollection.cs
- TraceUtility.cs
- ToolStripManager.cs
- RuleSetReference.cs
- ExpressionConverter.cs
- ActiveDocumentEvent.cs
- TransformConverter.cs
- ZipFileInfo.cs
- SourceFileInfo.cs
- DynamicField.cs
- FormViewRow.cs
- XsltQilFactory.cs
- ZipIOFileItemStream.cs
- StorageTypeMapping.cs
- elementinformation.cs
- Speller.cs
- CommandExpr.cs
- MediaScriptCommandRoutedEventArgs.cs
- ControlEvent.cs
- X509WindowsSecurityToken.cs
- AtomParser.cs
- EntityWrapperFactory.cs
- BlurBitmapEffect.cs
- HtmlElementErrorEventArgs.cs
- Propagator.Evaluator.cs
- WarningException.cs
- VersionValidator.cs
- NCryptNative.cs
- ConnectionInterfaceCollection.cs
- SelectorItemAutomationPeer.cs
- Comparer.cs
- PrePostDescendentsWalker.cs
- OperatorExpressions.cs
- InputScope.cs
- PhoneCall.cs
- TypeExtensionSerializer.cs
- DataListCommandEventArgs.cs
- XmlSchemaComplexType.cs
- DataControlButton.cs
- RequestStatusBarUpdateEventArgs.cs
- EventWaitHandle.cs
- VersionedStream.cs
- AbstractExpressions.cs
- XsdBuildProvider.cs
- InteropBitmapSource.cs
- StylusPointPropertyInfo.cs
- GeneralTransformGroup.cs
- ElementHostAutomationPeer.cs
- ObjectManager.cs
- StrongName.cs
- ByteAnimation.cs
- AsyncDataRequest.cs
- FlowDocumentView.cs
- GetLedgerEntryForRecipientRequest.cs
- RSAOAEPKeyExchangeFormatter.cs
- ImageClickEventArgs.cs
- DetailsViewDeletedEventArgs.cs
- TimeZone.cs
- ObjectStorage.cs
- TraceHandler.cs
- MainMenu.cs
- ProfileElement.cs
- NavigationService.cs
- SchemaObjectWriter.cs
- SafeNativeMethodsMilCoreApi.cs
- SafeCancelMibChangeNotify.cs
- Point3D.cs
- OperationParameterInfo.cs
- Quad.cs
- CommandBindingCollection.cs
- XsdDuration.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- PathBox.cs
- NodeFunctions.cs
- DataGridRow.cs
- TypeReference.cs
- FontStretch.cs
- TemplateBindingExtensionConverter.cs