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
- DeflateInput.cs
- StoreItemCollection.Loader.cs
- ThreadExceptionEvent.cs
- WindowsUpDown.cs
- ListViewGroupConverter.cs
- UITypeEditor.cs
- AppliedDeviceFiltersDialog.cs
- CompositeActivityTypeDescriptorProvider.cs
- StreamAsIStream.cs
- IndexedEnumerable.cs
- WmlTextViewAdapter.cs
- AppDomainInfo.cs
- BinaryObjectReader.cs
- MenuAdapter.cs
- StrokeCollectionConverter.cs
- SamlDelegatingWriter.cs
- PtsHelper.cs
- SymDocumentType.cs
- Line.cs
- EnumBuilder.cs
- Parsers.cs
- ProxyOperationRuntime.cs
- BitmapCodecInfo.cs
- RadialGradientBrush.cs
- XPathScanner.cs
- SqlFacetAttribute.cs
- RepeatButton.cs
- MissingManifestResourceException.cs
- UIPermission.cs
- AddingNewEventArgs.cs
- Frame.cs
- BulletedListEventArgs.cs
- StylusDevice.cs
- CqlLexerHelpers.cs
- InfoCardHelper.cs
- DataReceivedEventArgs.cs
- XmlDocumentSerializer.cs
- FileSystemWatcher.cs
- GenericsInstances.cs
- WebControlsSection.cs
- CompositeControl.cs
- UnsafeNativeMethodsCLR.cs
- CodeCommentStatementCollection.cs
- HttpProtocolImporter.cs
- IndentedWriter.cs
- SiblingIterators.cs
- RegistryKey.cs
- RegexMatchCollection.cs
- Repeater.cs
- HttpListener.cs
- LinearGradientBrush.cs
- BoundField.cs
- TaskHelper.cs
- VisualStateGroup.cs
- Nodes.cs
- EntityCollection.cs
- PreviewKeyDownEventArgs.cs
- UnsafeNativeMethods.cs
- ToolStripArrowRenderEventArgs.cs
- XmlTypeAttribute.cs
- HandlerFactoryCache.cs
- MeasureItemEvent.cs
- D3DImage.cs
- Operator.cs
- Line.cs
- X509CertificateCollection.cs
- XPathBinder.cs
- _NestedSingleAsyncResult.cs
- AlphabeticalEnumConverter.cs
- BinaryWriter.cs
- Track.cs
- Win32Exception.cs
- FileLogRecord.cs
- SqlMethodAttribute.cs
- HtmlControlPersistable.cs
- CommandBindingCollection.cs
- IntSecurity.cs
- cookie.cs
- OdbcConnectionStringbuilder.cs
- DateBoldEvent.cs
- HMACRIPEMD160.cs
- DbProviderFactories.cs
- Calendar.cs
- MdiWindowListStrip.cs
- SqlCacheDependencySection.cs
- DropAnimation.xaml.cs
- PocoPropertyAccessorStrategy.cs
- CommonProperties.cs
- TypeSystem.cs
- AutomationPattern.cs
- ViewStateException.cs
- PointAnimationUsingKeyFrames.cs
- HtmlTextArea.cs
- DoubleConverter.cs
- DocumentSignatureManager.cs
- SqlCacheDependencyDatabaseCollection.cs
- OwnerDrawPropertyBag.cs
- MappingException.cs
- PointConverter.cs
- VerticalAlignConverter.cs