Code:
/ FX-1434 / FX-1434 / 1.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
- XmlFormatReaderGenerator.cs
- ShaderRenderModeValidation.cs
- ButtonChrome.cs
- MenuBindingsEditorForm.cs
- StoreContentChangedEventArgs.cs
- XmlSchemaCollection.cs
- ProcessHost.cs
- LogAppendAsyncResult.cs
- PolicyUnit.cs
- CompilerHelpers.cs
- RealProxy.cs
- Hashtable.cs
- RoutingBehavior.cs
- MsmqMessage.cs
- followingquery.cs
- DataTableReaderListener.cs
- SqlNodeAnnotation.cs
- SrgsItemList.cs
- ToolBarButtonClickEvent.cs
- SqlCommandSet.cs
- ScrollChrome.cs
- WebEvents.cs
- Font.cs
- CodeConditionStatement.cs
- SQLByte.cs
- InternalResources.cs
- ImageButton.cs
- KeysConverter.cs
- SqlClientPermission.cs
- DictionaryBase.cs
- DataGridDesigner.cs
- ObjectDataSourceStatusEventArgs.cs
- MulticastNotSupportedException.cs
- WindowsProgressbar.cs
- CounterCreationDataCollection.cs
- PowerModeChangedEventArgs.cs
- ContractTypeNameElement.cs
- DataRowView.cs
- ReachBasicContext.cs
- TextLine.cs
- XmlSchemaChoice.cs
- UrlMappingsSection.cs
- TagPrefixInfo.cs
- CookieProtection.cs
- TreeNodeStyle.cs
- WebDisplayNameAttribute.cs
- DataServiceClientException.cs
- LayoutEditorPart.cs
- DataColumn.cs
- XmlSchemaSimpleType.cs
- CustomTypeDescriptor.cs
- remotingproxy.cs
- NonSerializedAttribute.cs
- CqlIdentifiers.cs
- RowType.cs
- TextTreeDeleteContentUndoUnit.cs
- InputScopeManager.cs
- XmlSiteMapProvider.cs
- SqlFactory.cs
- BackgroundFormatInfo.cs
- SoapReflectionImporter.cs
- TemplatedMailWebEventProvider.cs
- IPAddress.cs
- MeasurementDCInfo.cs
- StreamMarshaler.cs
- SmtpException.cs
- PointHitTestParameters.cs
- TextServicesManager.cs
- RenderData.cs
- HttpDictionary.cs
- PersonalizationStateInfo.cs
- DataGridViewCellStyle.cs
- SecurityTokenValidationException.cs
- AddInToken.cs
- Configuration.cs
- TokenBasedSet.cs
- ConfigurationLocation.cs
- PrintDialogException.cs
- DictionarySectionHandler.cs
- RemoteWebConfigurationHost.cs
- RadioButtonDesigner.cs
- SmtpDigestAuthenticationModule.cs
- UserControlCodeDomTreeGenerator.cs
- DeploymentSection.cs
- VisemeEventArgs.cs
- __Filters.cs
- CodePropertyReferenceExpression.cs
- MetadataPropertyvalue.cs
- ToolStripTextBox.cs
- DocumentReference.cs
- smtpconnection.cs
- OracleCommandSet.cs
- DBCSCodePageEncoding.cs
- XPathNodeList.cs
- MonthChangedEventArgs.cs
- ScriptingJsonSerializationSection.cs
- XslCompiledTransform.cs
- MailMessageEventArgs.cs
- MarkupObject.cs
- ListenerSessionConnection.cs