Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ManualResetEventSlim.cs
- Item.cs
- TextEditorCharacters.cs
- AsnEncodedData.cs
- PointConverter.cs
- _NegoState.cs
- SplineKeyFrames.cs
- SqlRowUpdatedEvent.cs
- LocalizationParserHooks.cs
- WindowsToolbar.cs
- SessionStateModule.cs
- XPathDocumentIterator.cs
- ImportCatalogPart.cs
- CollectionViewProxy.cs
- LambdaCompiler.ControlFlow.cs
- DiagnosticsElement.cs
- tibetanshape.cs
- RecognizeCompletedEventArgs.cs
- Int32Rect.cs
- BinaryObjectReader.cs
- Repeater.cs
- URL.cs
- Scalars.cs
- Evidence.cs
- XmlDictionaryReaderQuotas.cs
- FileIOPermission.cs
- RuleConditionDialog.cs
- CriticalHandle.cs
- DebugView.cs
- TemplateBindingExtensionConverter.cs
- XmlText.cs
- Registry.cs
- EventLogLink.cs
- EmbeddedObject.cs
- OrderablePartitioner.cs
- SoapFormatExtensions.cs
- AsymmetricAlgorithm.cs
- ControlOperationInvoker.cs
- DetailsViewInsertEventArgs.cs
- CompareInfo.cs
- XmlILOptimizerVisitor.cs
- MaskedTextBox.cs
- ExecutedRoutedEventArgs.cs
- Console.cs
- PerformanceCountersElement.cs
- DefaultShape.cs
- Util.cs
- InsufficientMemoryException.cs
- Util.cs
- PreparingEnlistment.cs
- LinearGradientBrush.cs
- AsyncOperation.cs
- SecUtil.cs
- TransactionTable.cs
- TextViewDesigner.cs
- DataGridViewAdvancedBorderStyle.cs
- BasePattern.cs
- BitStack.cs
- SecurityException.cs
- AppliesToBehaviorDecisionTable.cs
- WhitespaceRuleReader.cs
- HyperLinkDesigner.cs
- ApplicationException.cs
- Win32PrintDialog.cs
- QueryLifecycle.cs
- CancelEventArgs.cs
- CounterCreationDataCollection.cs
- PropertyValueChangedEvent.cs
- FontDialog.cs
- FtpCachePolicyElement.cs
- CroppedBitmap.cs
- KoreanCalendar.cs
- LeafCellTreeNode.cs
- TraceFilter.cs
- QueryStringParameter.cs
- ConfigWriter.cs
- RepeatBehaviorConverter.cs
- OpenFileDialog.cs
- EntityParameter.cs
- CodeArrayCreateExpression.cs
- DebugView.cs
- ProxyWebPartManager.cs
- _AutoWebProxyScriptHelper.cs
- RuntimeConfigurationRecord.cs
- XmlWriter.cs
- HiddenFieldPageStatePersister.cs
- Vector3DCollectionConverter.cs
- SimpleFieldTemplateFactory.cs
- DesignerSerializationOptionsAttribute.cs
- MulticastIPAddressInformationCollection.cs
- UnmanagedHandle.cs
- ClonableStack.cs
- PeerApplicationLaunchInfo.cs
- ProcessModelInfo.cs
- ApplicationCommands.cs
- KeyboardEventArgs.cs
- TextDataBindingHandler.cs
- DropTarget.cs
- BindingExpressionBase.cs
- X509DefaultServiceCertificateElement.cs