Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / DataGridLinkButton.cs / 2 / DataGridLinkButton.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.Drawing;
using System.Web.Util;
///
/// Derived version of LinkButton used within a DataGrid.
///
[SupportsEventValidation]
internal sealed class DataGridLinkButton : LinkButton {
internal DataGridLinkButton() {}
protected internal override void Render(HtmlTextWriter writer) {
SetForeColor();
base.Render(writer);
}
///
/// In HTML hyperlinks always use the browser's link color.
/// For the DataGrid, we want all LinkButtons to honor the ForeColor setting.
/// This requires looking up into the control hierarchy to see if either the cell
/// or the containing row or table define a ForeColor.
///
private void SetForeColor() {
if (ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_FORECOLOR) == false) {
Color hyperLinkForeColor;
Control control = this;
for (int i = 0; i < 3; i++) {
control = control.Parent;
Debug.Assert(((i == 0) && (control is TableCell)) ||
((i == 1) && (control is TableRow)) ||
((i == 2) && (control is Table)));
hyperLinkForeColor = ((WebControl)control).ForeColor;
if (hyperLinkForeColor != Color.Empty) {
ForeColor = hyperLinkForeColor;
break;
}
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.Drawing;
using System.Web.Util;
///
/// Derived version of LinkButton used within a DataGrid.
///
[SupportsEventValidation]
internal sealed class DataGridLinkButton : LinkButton {
internal DataGridLinkButton() {}
protected internal override void Render(HtmlTextWriter writer) {
SetForeColor();
base.Render(writer);
}
///
/// In HTML hyperlinks always use the browser's link color.
/// For the DataGrid, we want all LinkButtons to honor the ForeColor setting.
/// This requires looking up into the control hierarchy to see if either the cell
/// or the containing row or table define a ForeColor.
///
private void SetForeColor() {
if (ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_FORECOLOR) == false) {
Color hyperLinkForeColor;
Control control = this;
for (int i = 0; i < 3; i++) {
control = control.Parent;
Debug.Assert(((i == 0) && (control is TableCell)) ||
((i == 1) && (control is TableRow)) ||
((i == 2) && (control is Table)));
hyperLinkForeColor = ((WebControl)control).ForeColor;
if (hyperLinkForeColor != Color.Empty) {
ForeColor = hyperLinkForeColor;
break;
}
}
}
}
}
}
// 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
- RegexStringValidatorAttribute.cs
- WorkflowInstance.cs
- AttachedPropertyInfo.cs
- StringBuilder.cs
- PeerCredential.cs
- HealthMonitoringSectionHelper.cs
- PhonemeEventArgs.cs
- PageAsyncTaskManager.cs
- ErrorFormatterPage.cs
- TransactionInterop.cs
- BitmapScalingModeValidation.cs
- Condition.cs
- MetadataArtifactLoaderResource.cs
- _Connection.cs
- CultureInfoConverter.cs
- TextServicesProperty.cs
- RandomNumberGenerator.cs
- ApplicationContext.cs
- DefaultValidator.cs
- StylusEventArgs.cs
- Facet.cs
- CodeBinaryOperatorExpression.cs
- HtmlInputReset.cs
- DataGridCaption.cs
- SimpleType.cs
- ObjectQuery.cs
- MappingMetadataHelper.cs
- RowVisual.cs
- SubMenuStyleCollection.cs
- TypeToken.cs
- ActivityWithResultValueSerializer.cs
- ColumnWidthChangedEvent.cs
- CapabilitiesUse.cs
- TrackBar.cs
- Matrix.cs
- SocketException.cs
- TextWriter.cs
- XamlSerializer.cs
- SessionStateContainer.cs
- Floater.cs
- HtmlFormWrapper.cs
- FloaterParagraph.cs
- oledbmetadatacolumnnames.cs
- TemplateBindingExtension.cs
- BuildProviderUtils.cs
- NetworkInformationException.cs
- DataObjectCopyingEventArgs.cs
- WebPartDisplayModeEventArgs.cs
- DataServiceClientException.cs
- ECDsa.cs
- DataGridViewUtilities.cs
- RegexFCD.cs
- RangeBase.cs
- XmlTextWriter.cs
- TextDecoration.cs
- MbpInfo.cs
- MenuItemStyleCollectionEditor.cs
- ComboBoxDesigner.cs
- WebConfigurationManager.cs
- ProxyGenerationError.cs
- XamlRtfConverter.cs
- OperandQuery.cs
- ADConnectionHelper.cs
- Point3DConverter.cs
- RelationshipConstraintValidator.cs
- SQLStringStorage.cs
- HtmlHead.cs
- StructuredProperty.cs
- PeerTransportListenAddressValidatorAttribute.cs
- odbcmetadatacollectionnames.cs
- Clock.cs
- XmlTextAttribute.cs
- Hex.cs
- ComplexTypeEmitter.cs
- PropertyGeneratedEventArgs.cs
- MailHeaderInfo.cs
- MasterPageParser.cs
- SmiConnection.cs
- ListView.cs
- XpsFilter.cs
- XmlIncludeAttribute.cs
- DataGridPageChangedEventArgs.cs
- SettingsAttributes.cs
- TypeConverterAttribute.cs
- HuffmanTree.cs
- DataGridAutoFormat.cs
- ToolboxComponentsCreatedEventArgs.cs
- Globals.cs
- TreeNodeCollection.cs
- MetadataItemEmitter.cs
- RelationshipNavigation.cs
- TypeBuilder.cs
- Math.cs
- XmlDictionary.cs
- IProvider.cs
- CodeExpressionCollection.cs
- TraceData.cs
- WinFormsComponentEditor.cs
- ImmutableObjectAttribute.cs
- DeflateStream.cs