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
- DbConnectionPoolOptions.cs
- DataStorage.cs
- TableCell.cs
- FileLogRecordStream.cs
- SafeRightsManagementQueryHandle.cs
- UTF7Encoding.cs
- TextEditorMouse.cs
- DataGridSortCommandEventArgs.cs
- ValidatorCollection.cs
- ColorConvertedBitmapExtension.cs
- PageSetupDialog.cs
- SapiRecoContext.cs
- XmlNamespaceMapping.cs
- ReaderWriterLockSlim.cs
- PreviewPageInfo.cs
- FileSystemInfo.cs
- MailMessageEventArgs.cs
- FileChangesMonitor.cs
- EventListener.cs
- RayHitTestParameters.cs
- DrawingContextDrawingContextWalker.cs
- DialogWindow.cs
- WebPartCancelEventArgs.cs
- XPathQilFactory.cs
- BooleanAnimationBase.cs
- RequestResizeEvent.cs
- TransformerInfo.cs
- ProfileSettingsCollection.cs
- NumberFunctions.cs
- HandledMouseEvent.cs
- UIElement3DAutomationPeer.cs
- DataGridViewColumnHeaderCell.cs
- CustomWebEventKey.cs
- XPathNodeIterator.cs
- StyleBamlTreeBuilder.cs
- UIElementIsland.cs
- SecurityDescriptor.cs
- CheckBoxBaseAdapter.cs
- TextBox.cs
- EncoderFallback.cs
- BitmapEffect.cs
- StateMachineExecutionState.cs
- OutputCacheProfile.cs
- LoginName.cs
- CurrencyWrapper.cs
- ParameterElement.cs
- EqualityComparer.cs
- PathFigureCollectionValueSerializer.cs
- OdbcDataAdapter.cs
- MethodImplAttribute.cs
- SqlDataRecord.cs
- CallInfo.cs
- ConnectionStringSettingsCollection.cs
- XmlSchemaComplexContentRestriction.cs
- SmtpCommands.cs
- TemplateBamlRecordReader.cs
- IdentityHolder.cs
- SelectionPattern.cs
- ResourcePool.cs
- HtmlInputReset.cs
- RectAnimation.cs
- ChtmlCommandAdapter.cs
- XPathAncestorIterator.cs
- ApplicationTrust.cs
- IndexExpression.cs
- Comparer.cs
- SqlExpressionNullability.cs
- SizeAnimation.cs
- TableRowCollection.cs
- ComponentSerializationService.cs
- AsymmetricAlgorithm.cs
- DataBoundControlAdapter.cs
- DeferredTextReference.cs
- SimpleHandlerFactory.cs
- IntermediatePolicyValidator.cs
- DataGridViewBand.cs
- CancellationHandlerDesigner.cs
- SecurityTokenRequirement.cs
- AdPostCacheSubstitution.cs
- ReadOnlyObservableCollection.cs
- SecurityTokenAuthenticator.cs
- HttpBrowserCapabilitiesWrapper.cs
- ClassData.cs
- ParseHttpDate.cs
- ComPlusThreadInitializer.cs
- WorkflowTerminatedException.cs
- DBSqlParserTable.cs
- GlobalItem.cs
- MonthCalendarDesigner.cs
- FlatButtonAppearance.cs
- DataGridViewCellStateChangedEventArgs.cs
- CoTaskMemHandle.cs
- Comparer.cs
- PrinterSettings.cs
- Operators.cs
- DrawTreeNodeEventArgs.cs
- StorageAssociationTypeMapping.cs
- _ProxyChain.cs
- InvokeBinder.cs
- PlanCompilerUtil.cs