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
- FunctionQuery.cs
- ObjectDataSourceView.cs
- StaticResourceExtension.cs
- ReadOnlyState.cs
- OutputScopeManager.cs
- ThrowOnMultipleAssignment.cs
- AnnotationComponentChooser.cs
- Animatable.cs
- HttpCachePolicyElement.cs
- EntityClientCacheKey.cs
- CommonProperties.cs
- PanelStyle.cs
- PenLineCapValidation.cs
- TextEditorContextMenu.cs
- KeyMatchBuilder.cs
- PanelDesigner.cs
- XamlSerializationHelper.cs
- ResXResourceReader.cs
- ConsumerConnectionPointCollection.cs
- SimpleMailWebEventProvider.cs
- HwndSourceParameters.cs
- LinqExpressionNormalizer.cs
- Crc32.cs
- HostedNamedPipeTransportManager.cs
- WebPartZoneCollection.cs
- NGCPageContentCollectionSerializerAsync.cs
- EventBuilder.cs
- CellRelation.cs
- WebSysDescriptionAttribute.cs
- TreeNodeCollection.cs
- _NetRes.cs
- BitmapSourceSafeMILHandle.cs
- SemaphoreFullException.cs
- SubordinateTransaction.cs
- XmlDeclaration.cs
- SectionInformation.cs
- XmlNodeChangedEventManager.cs
- SqlPersonalizationProvider.cs
- FileCodeGroup.cs
- SqlCachedBuffer.cs
- Rule.cs
- FileSystemEventArgs.cs
- SID.cs
- Predicate.cs
- CheckBox.cs
- CodeStatementCollection.cs
- TextBoxAutomationPeer.cs
- CommandDesigner.cs
- SoapUnknownHeader.cs
- Metadata.cs
- XXXInfos.cs
- DirectionalLight.cs
- Header.cs
- ClientConfigurationHost.cs
- QueryPageSettingsEventArgs.cs
- IOThreadScheduler.cs
- ObjectQuery.cs
- SqlDataSourceSelectingEventArgs.cs
- SortDescriptionCollection.cs
- DocumentViewerAutomationPeer.cs
- EventProxy.cs
- Light.cs
- GridView.cs
- SmtpReplyReader.cs
- InstanceLockLostException.cs
- ProtocolViolationException.cs
- DataSourceCacheDurationConverter.cs
- RuleCache.cs
- AppDomainAttributes.cs
- HttpModulesSection.cs
- ReadOnlyHierarchicalDataSource.cs
- StylusPlugin.cs
- HorizontalAlignConverter.cs
- DocumentCollection.cs
- ToolBar.cs
- ExpressionVisitor.cs
- LinkedList.cs
- ClientType.cs
- GifBitmapEncoder.cs
- HotSpot.cs
- ConfigurationPropertyAttribute.cs
- Int64Storage.cs
- ToolStripItemTextRenderEventArgs.cs
- LocationSectionRecord.cs
- ReflectionHelper.cs
- SystemKeyConverter.cs
- _BaseOverlappedAsyncResult.cs
- SchemaMerger.cs
- FtpRequestCacheValidator.cs
- Point.cs
- CodeLinePragma.cs
- WindowsMenu.cs
- streamingZipPartStream.cs
- StrokeCollectionDefaultValueFactory.cs
- AmbientEnvironment.cs
- MimeMultiPart.cs
- DefaultCommandConverter.cs
- DataExpression.cs
- Guid.cs
- Funcletizer.cs