Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / DataGridLinkButton.cs / 1305376 / 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. // //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataListGeneralPage.cs
- SchemaCollectionPreprocessor.cs
- Window.cs
- RectIndependentAnimationStorage.cs
- CodeTypeDeclaration.cs
- ColorConverter.cs
- RegionData.cs
- DataGridViewColumn.cs
- DockAndAnchorLayout.cs
- InternalBase.cs
- RuntimeWrappedException.cs
- StaticDataManager.cs
- FileLogRecord.cs
- SqlUdtInfo.cs
- XdrBuilder.cs
- ConstraintManager.cs
- DbInsertCommandTree.cs
- CounterSampleCalculator.cs
- SineEase.cs
- SymmetricAlgorithm.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ScriptResourceInfo.cs
- SQLBoolean.cs
- LocalizationCodeDomSerializer.cs
- RotateTransform3D.cs
- ExpressionList.cs
- SqlPersonalizationProvider.cs
- OSEnvironmentHelper.cs
- CompositionTarget.cs
- BufferBuilder.cs
- TimeIntervalCollection.cs
- XmlSchemaProviderAttribute.cs
- _ConnectStream.cs
- SafePEFileHandle.cs
- DeclarativeCatalogPart.cs
- SqlCrossApplyToCrossJoin.cs
- DateTimeOffsetConverter.cs
- Font.cs
- HijriCalendar.cs
- HttpServerProtocol.cs
- SchemaCreator.cs
- XmlSchemaGroup.cs
- BridgeDataRecord.cs
- Operand.cs
- OrderedDictionaryStateHelper.cs
- WeakReferenceEnumerator.cs
- XmlElementAttributes.cs
- TrailingSpaceComparer.cs
- ElementHostPropertyMap.cs
- RadioButtonBaseAdapter.cs
- OleDbCommand.cs
- EventLogPermissionEntryCollection.cs
- _UriTypeConverter.cs
- IDQuery.cs
- BuildProvider.cs
- RightsManagementEncryptedStream.cs
- CompositeDuplexElement.cs
- LinqDataSourceView.cs
- TemplateBuilder.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ACE.cs
- GridViewHeaderRowPresenter.cs
- HttpResponse.cs
- ConfigXmlAttribute.cs
- ComAdminWrapper.cs
- DataGridViewCellStyleChangedEventArgs.cs
- Int16Animation.cs
- BindingExpressionUncommonField.cs
- ThreadAbortException.cs
- ExtendedProperty.cs
- HttpInputStream.cs
- BuildProvidersCompiler.cs
- ListChangedEventArgs.cs
- SR.cs
- PropertyChangedEventArgs.cs
- SchemaImporterExtension.cs
- SurrogateChar.cs
- OdbcStatementHandle.cs
- DelegateHelpers.Generated.cs
- XmlSequenceWriter.cs
- ModifierKeysValueSerializer.cs
- CustomValidator.cs
- WebPartTracker.cs
- ProgramPublisher.cs
- TextServicesPropertyRanges.cs
- SrgsDocument.cs
- WebPartConnectionCollection.cs
- ForEachAction.cs
- CodeDomConfigurationHandler.cs
- FragmentQuery.cs
- ImportCatalogPart.cs
- XmlNode.cs
- ConfigurationSectionGroupCollection.cs
- XAMLParseException.cs
- _SslSessionsCache.cs
- ProcessManager.cs
- ValidationUtility.cs
- CodePrimitiveExpression.cs
- TdsParserSafeHandles.cs
- DataGridTableCollection.cs