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
- System.Data_BID.cs
- DataGridViewCellParsingEventArgs.cs
- UriSectionReader.cs
- ContourSegment.cs
- ComplexLine.cs
- ReturnType.cs
- LogWriteRestartAreaState.cs
- mediaeventshelper.cs
- ActivityValidationServices.cs
- DiagnosticsConfiguration.cs
- CqlBlock.cs
- Point.cs
- PackageRelationshipSelector.cs
- ContentFilePart.cs
- QueueProcessor.cs
- XmlSchemaSimpleContentRestriction.cs
- PreviewControlDesigner.cs
- HitTestParameters.cs
- SQLBinaryStorage.cs
- ColorConvertedBitmapExtension.cs
- IxmlLineInfo.cs
- CacheAxisQuery.cs
- ValidationSummary.cs
- ValuePatternIdentifiers.cs
- ConnectionStringsSection.cs
- DynamicRouteExpression.cs
- SocketException.cs
- FixedSOMContainer.cs
- WebBrowserSiteBase.cs
- FullTextBreakpoint.cs
- Pair.cs
- Size.cs
- RowUpdatedEventArgs.cs
- PipelineDeploymentState.cs
- ExtensionSimplifierMarkupObject.cs
- OdbcReferenceCollection.cs
- InfoCardCryptoHelper.cs
- HtmlGenericControl.cs
- PngBitmapDecoder.cs
- PersistenceMetadataNamespace.cs
- DataColumn.cs
- ToolTipAutomationPeer.cs
- WindowsFormsHelpers.cs
- TextDocumentView.cs
- FontConverter.cs
- VirtualPathUtility.cs
- TransformedBitmap.cs
- GestureRecognitionResult.cs
- TemplateControl.cs
- ControlUtil.cs
- oledbmetadatacollectionnames.cs
- DisplayInformation.cs
- MobileResource.cs
- TypedTableBaseExtensions.cs
- XmlLanguageConverter.cs
- ResourceContainer.cs
- LinkLabel.cs
- Matrix3DConverter.cs
- FixedSOMPage.cs
- SmiMetaData.cs
- QueryActivatableWorkflowsCommand.cs
- OleDbParameter.cs
- Models.cs
- WinEventQueueItem.cs
- FileStream.cs
- SmtpSection.cs
- NativeDirectoryServicesQueryAPIs.cs
- CollectionViewGroupInternal.cs
- MailWebEventProvider.cs
- BitmapSource.cs
- ModelItemCollection.cs
- ClientConfigurationHost.cs
- ObjectItemCollection.cs
- ChooseAction.cs
- FilterFactory.cs
- TableLayout.cs
- Directory.cs
- CalendarTable.cs
- WorkflowMarkupSerializationManager.cs
- IntSecurity.cs
- SynchronizationValidator.cs
- ParenthesizePropertyNameAttribute.cs
- Knowncolors.cs
- DataAdapter.cs
- XmlReflectionImporter.cs
- ToolStripTemplateNode.cs
- WorkItem.cs
- BaseTemplateCodeDomTreeGenerator.cs
- IODescriptionAttribute.cs
- SqlOuterApplyReducer.cs
- Walker.cs
- UrlMappingsSection.cs
- TypeSystem.cs
- Queue.cs
- CodeBlockBuilder.cs
- FilterFactory.cs
- TemplateContentLoader.cs
- util.cs
- X509Utils.cs
- BypassElement.cs