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
- PreApplicationStartMethodAttribute.cs
- Parsers.cs
- ResourceProviderFactory.cs
- AsymmetricKeyExchangeFormatter.cs
- BuilderElements.cs
- Matrix3DValueSerializer.cs
- XomlCompilerResults.cs
- CheckoutException.cs
- DocumentScope.cs
- DesignerHelpers.cs
- designeractionbehavior.cs
- SharedStream.cs
- ErrorView.xaml.cs
- DataServiceCollectionOfT.cs
- WebPartTracker.cs
- AtomServiceDocumentSerializer.cs
- HMACRIPEMD160.cs
- SecurityCriticalDataForSet.cs
- CharUnicodeInfo.cs
- StyleSheetDesigner.cs
- ReferenceTypeElement.cs
- ExpressionLink.cs
- PropertyRecord.cs
- _NegotiateClient.cs
- HierarchicalDataSourceControl.cs
- TargetControlTypeCache.cs
- RadioButton.cs
- SingleStorage.cs
- ServiceEndpointElement.cs
- ButtonColumn.cs
- ExtentKey.cs
- XmlUnspecifiedAttribute.cs
- ColumnWidthChangingEvent.cs
- InvalidDataException.cs
- PackageRelationship.cs
- ObjectParameter.cs
- LineInfo.cs
- ObjectDataSourceEventArgs.cs
- WpfSharedXamlSchemaContext.cs
- XPathNodeHelper.cs
- NeutralResourcesLanguageAttribute.cs
- BufferedStream.cs
- ScrollBarAutomationPeer.cs
- SqlOuterApplyReducer.cs
- PageHandlerFactory.cs
- TreeNodeBinding.cs
- TraceLevelStore.cs
- Filter.cs
- OneOf.cs
- JournalEntryListConverter.cs
- WindowsGraphics2.cs
- AsyncPostBackErrorEventArgs.cs
- WinInetCache.cs
- OracleRowUpdatedEventArgs.cs
- ToolStripContainer.cs
- BasicCellRelation.cs
- CompilerCollection.cs
- DbConnectionHelper.cs
- CollectionTypeElement.cs
- RadioButtonFlatAdapter.cs
- WindowShowOrOpenTracker.cs
- ScriptingSectionGroup.cs
- AppDomainManager.cs
- SapiGrammar.cs
- LinkUtilities.cs
- HttpResponse.cs
- _LocalDataStoreMgr.cs
- BuildResultCache.cs
- Decimal.cs
- ConfigXmlText.cs
- BigInt.cs
- PatternMatcher.cs
- GridLength.cs
- TraceUtils.cs
- MenuCommands.cs
- RectangleHotSpot.cs
- Cell.cs
- ViewService.cs
- TypeReference.cs
- DefaultBindingPropertyAttribute.cs
- MachineKeyConverter.cs
- RoleService.cs
- DocumentPaginator.cs
- SqlCaseSimplifier.cs
- AuthenticationModuleElementCollection.cs
- HttpRawResponse.cs
- DependencyPropertyConverter.cs
- AppDomain.cs
- ColumnCollection.cs
- DefaultPrintController.cs
- UncommonField.cs
- OracleBoolean.cs
- XmlSchemaIdentityConstraint.cs
- CodeThrowExceptionStatement.cs
- X509UI.cs
- BaseDataBoundControlDesigner.cs
- CodeThrowExceptionStatement.cs
- DataGridItem.cs
- UnsettableComboBox.cs
- SplitterPanel.cs