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
- ExpressionNormalizer.cs
- VariableDesigner.xaml.cs
- SoapCodeExporter.cs
- Classification.cs
- NameObjectCollectionBase.cs
- XmlLoader.cs
- SwitchAttribute.cs
- SqlDataReaderSmi.cs
- ZipIOModeEnforcingStream.cs
- HttpMethodConstraint.cs
- Boolean.cs
- RedistVersionInfo.cs
- PageThemeCodeDomTreeGenerator.cs
- ClockGroup.cs
- WindowsListViewItemStartMenu.cs
- RepeatEnumerable.cs
- SqlClientWrapperSmiStream.cs
- TableItemStyle.cs
- CheckBoxDesigner.cs
- TransformGroup.cs
- HashMembershipCondition.cs
- StackOverflowException.cs
- DrawingAttributeSerializer.cs
- DataGridSortCommandEventArgs.cs
- ValidationResult.cs
- TypedTableBase.cs
- RequiredAttributeAttribute.cs
- IPGlobalProperties.cs
- regiisutil.cs
- ArrayList.cs
- SmtpTransport.cs
- ToggleButton.cs
- XmlUtil.cs
- ContextDataSource.cs
- TextEditorContextMenu.cs
- WeakEventManager.cs
- DataGridViewCellStyleBuilderDialog.cs
- EnvironmentPermission.cs
- PopupEventArgs.cs
- SplitContainer.cs
- SQLDecimalStorage.cs
- ApplyTemplatesAction.cs
- ToolStripLocationCancelEventArgs.cs
- XmlTextAttribute.cs
- ByteKeyFrameCollection.cs
- XmlCustomFormatter.cs
- XmlUtil.cs
- StrokeFIndices.cs
- IsolatedStorageFileStream.cs
- DataServiceQuery.cs
- Set.cs
- Repeater.cs
- DataGridItem.cs
- GridEntry.cs
- ExtendedProperty.cs
- ItemContainerGenerator.cs
- ComplexTypeEmitter.cs
- DataControlFieldHeaderCell.cs
- ToolStripContentPanelRenderEventArgs.cs
- SaveFileDialogDesigner.cs
- LineProperties.cs
- List.cs
- Screen.cs
- MemberBinding.cs
- GridEntry.cs
- TracingConnectionInitiator.cs
- InfoCardArgumentException.cs
- CqlParser.cs
- HandlerFactoryWrapper.cs
- ExpressionBuilder.cs
- Char.cs
- HttpRuntimeSection.cs
- QueryResultOp.cs
- AQNBuilder.cs
- UInt16Converter.cs
- Formatter.cs
- WindowsGraphics2.cs
- GetChildSubtree.cs
- MatrixConverter.cs
- PersistenceContext.cs
- WebPartEditorCancelVerb.cs
- EmbossBitmapEffect.cs
- sqlnorm.cs
- XmlSchemaIdentityConstraint.cs
- DataGridViewLinkCell.cs
- MissingFieldException.cs
- TextSchema.cs
- CustomAttributeFormatException.cs
- Regex.cs
- Transform.cs
- KeyValueConfigurationCollection.cs
- DataGridViewRowHeaderCell.cs
- TimersDescriptionAttribute.cs
- BamlRecordWriter.cs
- ActiveXHelper.cs
- LayoutManager.cs
- XappLauncher.cs
- GradientBrush.cs
- ObjectContext.cs
- Mapping.cs