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
- EastAsianLunisolarCalendar.cs
- DataGridViewLayoutData.cs
- DataViewListener.cs
- CqlLexerHelpers.cs
- LayoutManager.cs
- ZoneIdentityPermission.cs
- SqlGenericUtil.cs
- SmiMetaData.cs
- XmlCodeExporter.cs
- HttpRequest.cs
- CodeTryCatchFinallyStatement.cs
- WebZone.cs
- HwndSource.cs
- WindowsListViewItemStartMenu.cs
- NullableLongSumAggregationOperator.cs
- XmlValueConverter.cs
- Application.cs
- RuntimeArgumentHandle.cs
- FormsAuthenticationUserCollection.cs
- TableNameAttribute.cs
- CodeConstructor.cs
- FormViewPageEventArgs.cs
- ThreadStaticAttribute.cs
- DataRowView.cs
- ScopedKnownTypes.cs
- SeekableReadStream.cs
- Exceptions.cs
- recordstatefactory.cs
- TextLineBreak.cs
- TypeGeneratedEventArgs.cs
- NoPersistScope.cs
- NetStream.cs
- ImmutableCollection.cs
- SafeRegistryHandle.cs
- ControlCollection.cs
- StylusPointPropertyUnit.cs
- FixedHyperLink.cs
- ServiceObjectContainer.cs
- UnauthorizedWebPart.cs
- DataGridViewMethods.cs
- FormatterServices.cs
- FileAuthorizationModule.cs
- ReadOnlyAttribute.cs
- TextDecorationCollection.cs
- DependencyPropertyConverter.cs
- CodeBlockBuilder.cs
- CheckBox.cs
- _LocalDataStore.cs
- URLString.cs
- BuilderPropertyEntry.cs
- SqlBulkCopyColumnMappingCollection.cs
- PreservationFileWriter.cs
- SqlUserDefinedTypeAttribute.cs
- ScrollableControl.cs
- Exception.cs
- AppDomainAttributes.cs
- CustomErrorCollection.cs
- JsonFormatGeneratorStatics.cs
- EventSinkActivityDesigner.cs
- ByteAnimation.cs
- GeneralTransform2DTo3DTo2D.cs
- OdbcConnectionString.cs
- TextBox.cs
- ThousandthOfEmRealDoubles.cs
- ChangePassword.cs
- RequestCacheEntry.cs
- sqlinternaltransaction.cs
- ObjectViewListener.cs
- webproxy.cs
- DescendantOverDescendantQuery.cs
- DocumentPageHost.cs
- UIElementHelper.cs
- ScriptingJsonSerializationSection.cs
- HttpErrorTraceRecord.cs
- InkSerializer.cs
- ToolStripSeparator.cs
- SqlDesignerDataSourceView.cs
- AnnotationHelper.cs
- XmlEntity.cs
- WorkflowInstance.cs
- MetadataSource.cs
- AutomationPropertyInfo.cs
- DictionaryBase.cs
- LiteralSubsegment.cs
- QilSortKey.cs
- CodeAttributeArgumentCollection.cs
- ConnectionStringsSection.cs
- Compilation.cs
- GradientStop.cs
- RelationshipType.cs
- Line.cs
- NamedElement.cs
- MDIClient.cs
- TCEAdapterGenerator.cs
- DbBuffer.cs
- DrawingContextDrawingContextWalker.cs
- SqlDataSourceCommandEventArgs.cs
- AssemblyNameProxy.cs
- Evaluator.cs
- BitStack.cs