Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / DataGridLinkButton.cs / 1 / 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
- AdRotator.cs
- CodeValidator.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- Image.cs
- ScrollPatternIdentifiers.cs
- MDIControlStrip.cs
- ExtendedPropertyDescriptor.cs
- MemberAccessException.cs
- FilePrompt.cs
- SpecularMaterial.cs
- XmlAtomicValue.cs
- IxmlLineInfo.cs
- EventLogEntryCollection.cs
- TrailingSpaceComparer.cs
- MetadataFile.cs
- TypeSystem.cs
- Console.cs
- DrawListViewItemEventArgs.cs
- XappLauncher.cs
- ColorConvertedBitmap.cs
- UriParserTemplates.cs
- SamlSerializer.cs
- TreeBuilderXamlTranslator.cs
- FontConverter.cs
- AccessKeyManager.cs
- SqlDataSourceParameterParser.cs
- SizeF.cs
- XmlWrappingWriter.cs
- DataGridViewColumnCollection.cs
- OLEDB_Util.cs
- SourceLocationProvider.cs
- DesignerActionVerbItem.cs
- XamlTypeWithExplicitNamespace.cs
- CodeStatementCollection.cs
- XmlILModule.cs
- TextSelectionHelper.cs
- ConnectorSelectionGlyph.cs
- Type.cs
- BulletChrome.cs
- ToolStripDropDownClosingEventArgs.cs
- NegotiateStream.cs
- InvalidComObjectException.cs
- SingleResultAttribute.cs
- OrderToken.cs
- DecoratedNameAttribute.cs
- Function.cs
- AsymmetricSignatureFormatter.cs
- TripleDESCryptoServiceProvider.cs
- XmlSubtreeReader.cs
- EntityDataSourceChangingEventArgs.cs
- GenerateHelper.cs
- FixedPageAutomationPeer.cs
- VectorKeyFrameCollection.cs
- ApplyHostConfigurationBehavior.cs
- SecurityDocument.cs
- ProcessInfo.cs
- MessageHeaderInfoTraceRecord.cs
- ITreeGenerator.cs
- RegistrySecurity.cs
- ViewBox.cs
- CodeCatchClauseCollection.cs
- TableLayoutCellPaintEventArgs.cs
- EventLogPermissionAttribute.cs
- DocumentViewerBaseAutomationPeer.cs
- InfiniteIntConverter.cs
- SecurityHeaderTokenResolver.cs
- StackBuilderSink.cs
- InvalidComObjectException.cs
- Matrix3D.cs
- TypeNameConverter.cs
- Duration.cs
- AutoResizedEvent.cs
- ControlsConfig.cs
- ReturnEventArgs.cs
- ClientSponsor.cs
- DrawingContextWalker.cs
- SoapProtocolImporter.cs
- OleDbConnectionInternal.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DbParameterCollectionHelper.cs
- EditingCoordinator.cs
- FontUnitConverter.cs
- DataGridColumn.cs
- DeclarativeCatalogPart.cs
- ResourceDisplayNameAttribute.cs
- SerialStream.cs
- _NativeSSPI.cs
- UserControlParser.cs
- PassportIdentity.cs
- MenuItemCollection.cs
- AutomationIdentifier.cs
- ComboBoxRenderer.cs
- AnnotationObservableCollection.cs
- LogWriteRestartAreaState.cs
- CancellationHandler.cs
- FlowNode.cs
- WebPartMinimizeVerb.cs
- WorkflowShape.cs
- JoinGraph.cs
- ObjectRef.cs