Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WCFServiceClientProxyGenerator.cs
- Relationship.cs
- RelatedView.cs
- TableCellCollection.cs
- SeekStoryboard.cs
- XmlNodeChangedEventManager.cs
- TreeNodeBindingCollection.cs
- Light.cs
- TimeSpan.cs
- UnlockInstanceCommand.cs
- AbstractDataSvcMapFileLoader.cs
- GroupLabel.cs
- SharedHttpTransportManager.cs
- RegisteredScript.cs
- FontStyles.cs
- RoleServiceManager.cs
- SQLMoney.cs
- AuthenticateEventArgs.cs
- AuthStoreRoleProvider.cs
- WebPartConnectionsDisconnectVerb.cs
- MaskPropertyEditor.cs
- CatalogPartCollection.cs
- Selection.cs
- XmlSchemaAny.cs
- LogicalCallContext.cs
- unitconverter.cs
- ZipIOModeEnforcingStream.cs
- HttpResponseMessageProperty.cs
- TextBounds.cs
- ErrorTableItemStyle.cs
- ServiceHttpHandlerFactory.cs
- XmlAttributes.cs
- DecimalKeyFrameCollection.cs
- WriteLine.cs
- CapiSafeHandles.cs
- SmiConnection.cs
- RuntimeHandles.cs
- DbBuffer.cs
- PublisherMembershipCondition.cs
- DocobjHost.cs
- DeferrableContent.cs
- MimeWriter.cs
- UInt64.cs
- UnauthorizedAccessException.cs
- TreeNodeCollectionEditor.cs
- WinEventQueueItem.cs
- InstallerTypeAttribute.cs
- NoResizeSelectionBorderGlyph.cs
- LastQueryOperator.cs
- StringSource.cs
- TextBox.cs
- safelinkcollection.cs
- OptimizedTemplateContent.cs
- InvalidDataException.cs
- ProfilePropertySettings.cs
- DependencyObjectType.cs
- XmlHierarchyData.cs
- RegisteredHiddenField.cs
- OdbcConnectionOpen.cs
- TreeChangeInfo.cs
- SizeConverter.cs
- TextOutput.cs
- WebHttpSecurity.cs
- KeyFrames.cs
- WebAdminConfigurationHelper.cs
- CodeDirectiveCollection.cs
- CodeTryCatchFinallyStatement.cs
- XmlDomTextWriter.cs
- EntityException.cs
- DefaultValueTypeConverter.cs
- IntAverageAggregationOperator.cs
- PropertySet.cs
- SynchronizedDispatch.cs
- GeneralTransformCollection.cs
- DBDataPermission.cs
- HighContrastHelper.cs
- TextPattern.cs
- FontCollection.cs
- KeyGestureConverter.cs
- MissingManifestResourceException.cs
- XmlHierarchicalDataSourceView.cs
- AuthenticationConfig.cs
- EditorPartChrome.cs
- CaretElement.cs
- OLEDB_Util.cs
- EventDescriptor.cs
- MailDefinition.cs
- DesignerDataConnection.cs
- Zone.cs
- BreakRecordTable.cs
- LoopExpression.cs
- LinkClickEvent.cs
- UnwrappedTypesXmlSerializerManager.cs
- WebPartZone.cs
- TransactionFlowOption.cs
- WorkflowInstance.cs
- SafeNativeMethods.cs
- FormViewInsertedEventArgs.cs
- XMLDiffLoader.cs
- InternalReceiveMessage.cs