Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebControls / HyperLinkDesigner.cs / 1 / HyperLinkDesigner.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.Design.WebControls {
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System;
using System.Web.UI.WebControls;
using Microsoft.Win32;
///
///
///
/// The designer for the
/// web control.
///
///
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
[SupportsPreviewControl(true)]
public class HyperLinkDesigner : TextControlDesigner {
///
///
///
/// Gets the design time HTML of the
/// control.
///
///
public override string GetDesignTimeHtml() {
HyperLink h = (HyperLink)Component;
string originalText = h.Text;
string imageUrl = h.ImageUrl;
string originalUrl = h.NavigateUrl;
Debug.Assert(originalText != null);
Debug.Assert(imageUrl != null);
Debug.Assert(originalUrl != null);
bool blankText = (originalText.Trim().Length == 0) && (imageUrl.Trim().Length == 0);
bool blankUrl = (originalUrl.Trim().Length == 0);
bool hasControls = h.HasControls();
Control[] children = null;
if (blankText) {
if (hasControls) {
children = new Control[h.Controls.Count];
h.Controls.CopyTo(children, 0);
}
h.Text = "[" + h.ID + "]";
}
if (blankUrl) {
h.NavigateUrl = "url";
}
string html;
try {
html = base.GetDesignTimeHtml();
}
finally {
if (blankText) {
h.Text = originalText;
if (hasControls) {
foreach (Control c in children) {
h.Controls.Add(c);
}
}
}
if (blankUrl) {
h.NavigateUrl = originalUrl;
}
}
return html;
}
public override void OnComponentChanged(object sender, ComponentChangedEventArgs ce) {
base.OnComponentChanged(sender, new ComponentChangedEventArgs(ce.Component, null, null, null));
}
}
}
// 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
- BindingManagerDataErrorEventArgs.cs
- DataGridViewCellCollection.cs
- AstNode.cs
- EntityDataSourceMemberPath.cs
- MemberCollection.cs
- UniqueIdentifierService.cs
- AssemblyResourceLoader.cs
- Panel.cs
- CurrencyWrapper.cs
- SchemaHelper.cs
- RoutedPropertyChangedEventArgs.cs
- XmlAggregates.cs
- SQLUtility.cs
- TimeSpanValidatorAttribute.cs
- ModuleConfigurationInfo.cs
- EFAssociationProvider.cs
- ISCIIEncoding.cs
- CustomAssemblyResolver.cs
- DetailsViewUpdatedEventArgs.cs
- MenuItemStyleCollection.cs
- _NetRes.cs
- ProxyFragment.cs
- VariableModifiersHelper.cs
- PowerStatus.cs
- ToolboxComponentsCreatingEventArgs.cs
- MemberDomainMap.cs
- StatusBarItem.cs
- WeakEventTable.cs
- IdentifierElement.cs
- DefaultMemberAttribute.cs
- ReflectionUtil.cs
- XsltContext.cs
- StringConverter.cs
- TabletCollection.cs
- CodeRemoveEventStatement.cs
- DeferredBinaryDeserializerExtension.cs
- SymmetricKey.cs
- TypePropertyEditor.cs
- OutArgument.cs
- _ListenerResponseStream.cs
- SessionParameter.cs
- PhysicalFontFamily.cs
- SmtpNegotiateAuthenticationModule.cs
- TCPListener.cs
- WebServiceEnumData.cs
- Unit.cs
- _NegoState.cs
- InstalledFontCollection.cs
- SystemIcmpV4Statistics.cs
- MenuCommandService.cs
- TextSpanModifier.cs
- ComplexBindingPropertiesAttribute.cs
- TrackingAnnotationCollection.cs
- CacheDependency.cs
- FieldAccessException.cs
- SelectedCellsCollection.cs
- CryptoApi.cs
- HtmlPhoneCallAdapter.cs
- VSWCFServiceContractGenerator.cs
- AsyncPostBackErrorEventArgs.cs
- SocketInformation.cs
- ControlBindingsCollection.cs
- ErrorInfoXmlDocument.cs
- ChildChangedEventArgs.cs
- XmlDataImplementation.cs
- SystemIPGlobalStatistics.cs
- KeySpline.cs
- IsolatedStorageFileStream.cs
- HybridDictionary.cs
- URI.cs
- UniqueIdentifierService.cs
- BitmapEffectGeneralTransform.cs
- _Win32.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ExceptionUtil.cs
- ModelItemDictionary.cs
- StorageMappingFragment.cs
- SiteMapPathDesigner.cs
- DictionaryContent.cs
- PkcsMisc.cs
- BindStream.cs
- GeometryCollection.cs
- RelationHandler.cs
- ComponentCollection.cs
- SuppressMergeCheckAttribute.cs
- TypeUtil.cs
- FixedSOMImage.cs
- Wildcard.cs
- DataGridCell.cs
- columnmapfactory.cs
- ToolStripItem.cs
- EncodingDataItem.cs
- ListViewInsertEventArgs.cs
- TypeBuilderInstantiation.cs
- ADMembershipProvider.cs
- XmlCharCheckingWriter.cs
- EntityDataSource.cs
- TableCell.cs
- SqlTypesSchemaImporter.cs
- DoubleUtil.cs