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
- BaseInfoTable.cs
- HuffmanTree.cs
- DropSourceBehavior.cs
- DataGrid.cs
- UriSection.cs
- TemplateBindingExtensionConverter.cs
- CodeTypeMember.cs
- GridView.cs
- DataGridPagerStyle.cs
- TextUtf8RawTextWriter.cs
- RequestCache.cs
- HashJoinQueryOperatorEnumerator.cs
- ScriptingAuthenticationServiceSection.cs
- DialogBaseForm.cs
- ClientEventManager.cs
- ButtonStandardAdapter.cs
- HtmlTextArea.cs
- BitmapCodecInfoInternal.cs
- Rect.cs
- Label.cs
- MailMessage.cs
- SelectionChangedEventArgs.cs
- XmlBaseWriter.cs
- RSAPKCS1SignatureFormatter.cs
- DataBinder.cs
- DataSourceView.cs
- LineUtil.cs
- RoleBoolean.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ObjectTag.cs
- ToolStripItemDesigner.cs
- SqlProcedureAttribute.cs
- DataGridViewColumnConverter.cs
- WSTrustDec2005.cs
- PLINQETWProvider.cs
- ClientTarget.cs
- OletxTransactionFormatter.cs
- initElementDictionary.cs
- InputProviderSite.cs
- HttpListenerRequest.cs
- GeneralTransformGroup.cs
- Int32RectValueSerializer.cs
- TemplatedAdorner.cs
- ByteStream.cs
- dsa.cs
- CodeTypeParameterCollection.cs
- Literal.cs
- ExpressionNode.cs
- CellConstantDomain.cs
- SimpleWorkerRequest.cs
- SchemaContext.cs
- HtmlCalendarAdapter.cs
- SoapExtensionStream.cs
- ToolStripPanelRow.cs
- FileDialogCustomPlace.cs
- ComponentEvent.cs
- ConfigXmlSignificantWhitespace.cs
- ModuleBuilderData.cs
- DateRangeEvent.cs
- ServiceOperationParameter.cs
- ResolveDuplex11AsyncResult.cs
- CompilerScopeManager.cs
- ImageList.cs
- SolidColorBrush.cs
- HttpModuleActionCollection.cs
- TypefaceMetricsCache.cs
- TransformedBitmap.cs
- ColorTransformHelper.cs
- RadioButtonDesigner.cs
- FactoryMaker.cs
- ImageConverter.cs
- CheckBoxPopupAdapter.cs
- StorageAssociationSetMapping.cs
- XmlSerializationGeneratedCode.cs
- ReachSerializer.cs
- Helpers.cs
- CodeObject.cs
- TextTreePropertyUndoUnit.cs
- DefaultObjectMappingItemCollection.cs
- GridViewDesigner.cs
- PrivateFontCollection.cs
- RulePatternOps.cs
- PcmConverter.cs
- StaticFileHandler.cs
- XPathNodeInfoAtom.cs
- SuppressedPackageProperties.cs
- ChangeTracker.cs
- ApplicationContext.cs
- DomainUpDown.cs
- ExtensionDataReader.cs
- RectangleConverter.cs
- contentDescriptor.cs
- CellLabel.cs
- OrderPreservingMergeHelper.cs
- MaskedTextProvider.cs
- XamlNamespaceHelper.cs
- XmlSchemaElement.cs
- indexingfiltermarshaler.cs
- XmlSchemaInclude.cs
- RealizationDrawingContextWalker.cs