Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / DataGridLinkButton.cs / 2 / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PackagePartCollection.cs
- ImageList.cs
- FormatterConverter.cs
- TypeDependencyAttribute.cs
- WpfSharedXamlSchemaContext.cs
- FormsAuthenticationUser.cs
- XmlAnyAttributeAttribute.cs
- XmlNavigatorStack.cs
- COM2ExtendedTypeConverter.cs
- MaskInputRejectedEventArgs.cs
- FacetDescriptionElement.cs
- ListenerHandler.cs
- SessionPageStateSection.cs
- HttpProtocolImporter.cs
- LinqDataSourceContextEventArgs.cs
- ExpressionBuilderCollection.cs
- PermissionAttributes.cs
- SqlClientPermission.cs
- PeerDuplexChannel.cs
- XmlSerializerSection.cs
- DatatypeImplementation.cs
- SQLDoubleStorage.cs
- IISMapPath.cs
- DetailsViewPageEventArgs.cs
- DbConnectionFactory.cs
- JavaScriptObjectDeserializer.cs
- UMPAttributes.cs
- GACIdentityPermission.cs
- XamlStyleSerializer.cs
- TraceProvider.cs
- OutputScope.cs
- BrushValueSerializer.cs
- FileDocument.cs
- MeshGeometry3D.cs
- ToolStripContentPanelDesigner.cs
- ViewUtilities.cs
- TimelineClockCollection.cs
- LockCookie.cs
- XPathParser.cs
- SchemaCollectionPreprocessor.cs
- UseAttributeSetsAction.cs
- BuildResult.cs
- DefaultParameterValueAttribute.cs
- CounterCreationDataConverter.cs
- SessionEndedEventArgs.cs
- XamlReader.cs
- GetPageNumberCompletedEventArgs.cs
- GacUtil.cs
- WebPartConnectionsConfigureVerb.cs
- ParseElementCollection.cs
- TextReader.cs
- BrowsableAttribute.cs
- BitmapCache.cs
- ListBoxAutomationPeer.cs
- RectangleConverter.cs
- GridPattern.cs
- TimeIntervalCollection.cs
- InvalidDataContractException.cs
- MDIControlStrip.cs
- Events.cs
- ContentElement.cs
- ServiceParser.cs
- WebPartZoneDesigner.cs
- MappedMetaModel.cs
- EventProviderBase.cs
- HttpApplication.cs
- CallbackHandler.cs
- CookieHandler.cs
- TypeElement.cs
- WeakHashtable.cs
- RemoteWebConfigurationHostStream.cs
- SettingsPropertyWrongTypeException.cs
- DataColumnCollection.cs
- ObjectView.cs
- LockCookie.cs
- MethodRental.cs
- Listbox.cs
- FocusChangedEventArgs.cs
- TrustManagerMoreInformation.cs
- DataColumnMapping.cs
- TransportContext.cs
- FontSourceCollection.cs
- ScriptControlManager.cs
- Mutex.cs
- precedingsibling.cs
- EventLogPermissionAttribute.cs
- TextParagraph.cs
- OdbcStatementHandle.cs
- RequestCachePolicy.cs
- XNameTypeConverter.cs
- AccessDataSource.cs
- NumericUpDownAccelerationCollection.cs
- WinFormsComponentEditor.cs
- ProviderCollection.cs
- BaseDataListActionList.cs
- RuntimeEnvironment.cs
- Int16AnimationBase.cs
- ListViewTableCell.cs
- TreeViewItem.cs
- TreeNodeBindingDepthConverter.cs