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
- HyperLinkField.cs
- RowsCopiedEventArgs.cs
- PathParser.cs
- XmlQueryRuntime.cs
- ExtenderProviderService.cs
- NativeMethods.cs
- StylusPoint.cs
- JsonServiceDocumentSerializer.cs
- CustomPopupPlacement.cs
- SupportsEventValidationAttribute.cs
- SourceFilter.cs
- uribuilder.cs
- ParameterElementCollection.cs
- HiddenField.cs
- PersistenceTypeAttribute.cs
- PixelFormat.cs
- IssuedSecurityTokenProvider.cs
- HttpListenerRequestUriBuilder.cs
- DiscoveryCallbackBehavior.cs
- ServiceHostFactory.cs
- ConnectionPoolManager.cs
- SettingsPropertyNotFoundException.cs
- NetPeerTcpBindingElement.cs
- Keywords.cs
- StylusButtonCollection.cs
- _LocalDataStoreMgr.cs
- DataPagerField.cs
- CodeSubDirectoriesCollection.cs
- InputProviderSite.cs
- MultiBindingExpression.cs
- CodeMethodInvokeExpression.cs
- CreateUserWizard.cs
- FileReader.cs
- IndependentAnimationStorage.cs
- ApplicationException.cs
- DataObjectAttribute.cs
- Pen.cs
- Misc.cs
- IsolatedStoragePermission.cs
- RowToFieldTransformer.cs
- ReaderWriterLock.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- CellQuery.cs
- AuthenticateEventArgs.cs
- SchemaImporterExtensionElement.cs
- FrameSecurityDescriptor.cs
- EncodingDataItem.cs
- SQLResource.cs
- MemoryMappedView.cs
- DesignerProperties.cs
- CodeConditionStatement.cs
- IERequestCache.cs
- XsltConvert.cs
- UriTemplateTrieNode.cs
- DES.cs
- SqlDataSourceEnumerator.cs
- ObjectIDGenerator.cs
- Win32Native.cs
- Preprocessor.cs
- HashCodeCombiner.cs
- Match.cs
- ExceptionDetail.cs
- MSG.cs
- Restrictions.cs
- SliderAutomationPeer.cs
- BooleanToVisibilityConverter.cs
- AppDomain.cs
- Path.cs
- AsynchronousChannel.cs
- CompiledRegexRunner.cs
- TextViewDesigner.cs
- DbDataAdapter.cs
- ElementFactory.cs
- WebPartTransformerCollection.cs
- CryptoProvider.cs
- CalendarDataBindingHandler.cs
- RelativeSource.cs
- DataSourceHelper.cs
- Label.cs
- XPathDocumentIterator.cs
- InkCanvasFeedbackAdorner.cs
- SafeNativeMethodsCLR.cs
- TypeLoadException.cs
- MdiWindowListItemConverter.cs
- ListControlConvertEventArgs.cs
- SqlTriggerAttribute.cs
- TableLayoutStyleCollection.cs
- WmlCalendarAdapter.cs
- CompiledRegexRunnerFactory.cs
- BaseParser.cs
- XsdBuilder.cs
- QueryReaderSettings.cs
- NominalTypeEliminator.cs
- MessageBox.cs
- InstanceView.cs
- DataTrigger.cs
- Environment.cs
- ReflectionTypeLoadException.cs
- ConcurrentQueue.cs
- XmlSchemaInclude.cs