Code:
/ DotNET / DotNET / 8.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
- StateMachineExecutionState.cs
- CustomError.cs
- ErrorFormatterPage.cs
- OutputScopeManager.cs
- WeakEventManager.cs
- CollectionViewProxy.cs
- ExclusiveHandleList.cs
- COM2Properties.cs
- SiteMapNodeItem.cs
- WebPartMenu.cs
- DataGridCaption.cs
- DataColumnPropertyDescriptor.cs
- ClickablePoint.cs
- CapabilitiesRule.cs
- SqlBinder.cs
- IncrementalReadDecoders.cs
- X500Name.cs
- ClipboardProcessor.cs
- SupportsEventValidationAttribute.cs
- AnchoredBlock.cs
- Filter.cs
- CustomErrorCollection.cs
- ExpressionBindings.cs
- SurrogateChar.cs
- ScriptingSectionGroup.cs
- Bidi.cs
- RenderData.cs
- DaylightTime.cs
- DataMemberConverter.cs
- ZipIOBlockManager.cs
- ModelItemCollection.cs
- shaperfactory.cs
- TableItemProviderWrapper.cs
- ConnectionManagementSection.cs
- DataGridRow.cs
- HtmlWindow.cs
- serverconfig.cs
- Positioning.cs
- KeyedCollection.cs
- SoapAttributeOverrides.cs
- DbDataSourceEnumerator.cs
- X509Certificate2.cs
- TraceHwndHost.cs
- NetSectionGroup.cs
- LoadedOrUnloadedOperation.cs
- RedBlackList.cs
- AttributeUsageAttribute.cs
- CustomErrorCollection.cs
- ReadOnlyPropertyMetadata.cs
- StylusDevice.cs
- DesignTimeTemplateParser.cs
- DocumentViewerBase.cs
- ScriptControl.cs
- ActivityValidator.cs
- QueryOutputWriter.cs
- PageContentAsyncResult.cs
- DispatcherOperation.cs
- Menu.cs
- TableRow.cs
- PathHelper.cs
- NameObjectCollectionBase.cs
- TextRenderer.cs
- HtmlTableCellCollection.cs
- Vector3DCollection.cs
- HandleCollector.cs
- MouseGestureValueSerializer.cs
- ServerIdentity.cs
- DataGridViewColumnConverter.cs
- AndMessageFilter.cs
- Pick.cs
- Logging.cs
- sortedlist.cs
- HealthMonitoringSection.cs
- ThumbButtonInfoCollection.cs
- SerialPort.cs
- HtmlHistory.cs
- ImageField.cs
- ColumnHeaderConverter.cs
- ChannelServices.cs
- ProxyManager.cs
- ContainerControlDesigner.cs
- AttributeXamlType.cs
- NextPreviousPagerField.cs
- IndexerNameAttribute.cs
- PixelFormatConverter.cs
- Geometry3D.cs
- ResXBuildProvider.cs
- JapaneseLunisolarCalendar.cs
- PageThemeBuildProvider.cs
- ProcessHostServerConfig.cs
- StringAnimationUsingKeyFrames.cs
- TokenFactoryCredential.cs
- FixedFindEngine.cs
- PersonalizationDictionary.cs
- GacUtil.cs
- ProcessingInstructionAction.cs
- EventToken.cs
- XmlTextReaderImplHelpers.cs
- ListControl.cs
- DocumentsTrace.cs