Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / DataControlLinkButton.cs / 2 / DataControlLinkButton.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 DataControl. /// [SupportsEventValidation] internal class DataControlLinkButton : LinkButton { IPostBackContainer _container; string _callbackArgument; bool _enableCallback; internal DataControlLinkButton(IPostBackContainer container) { _container = container; } public override bool CausesValidation { get { if (_container != null) { return false; } return base.CausesValidation; } set { if (_container != null) { throw new NotSupportedException(SR.GetString(SR.CannotSetValidationOnDataControlButtons)); } base.CausesValidation = value; } } internal void EnableCallback(string argument) { _enableCallback = true; _callbackArgument = argument; } protected override PostBackOptions GetPostBackOptions() { if (_container != null) { return _container.GetPostBackOptions(this); } return base.GetPostBackOptions(); } protected internal override void Render(HtmlTextWriter writer) { SetCallbackProperties(); SetForeColor(); base.Render(writer); } private void SetCallbackProperties() { if (_enableCallback) { ICallbackContainer _callbackContainer = _container as ICallbackContainer; if (_callbackContainer != null) { string callbackScript = _callbackContainer.GetCallbackScript(this, _callbackArgument); if (!String.IsNullOrEmpty(callbackScript)) { this.OnClientClick = callbackScript; } } } } ////// In HTML hyperlinks always use the browser's link color. /// For the DataControl, 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. /// protected virtual 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
- CrossAppDomainChannel.cs
- UnionCodeGroup.cs
- EmptyEnumerable.cs
- DurableEnlistmentState.cs
- SimpleType.cs
- FrameworkContentElement.cs
- APCustomTypeDescriptor.cs
- XmlBaseReader.cs
- ServiceHostFactory.cs
- InfoCardRSACryptoProvider.cs
- ToolStripItemTextRenderEventArgs.cs
- HatchBrush.cs
- SectionRecord.cs
- QilTernary.cs
- HttpListenerPrefixCollection.cs
- EncoderParameter.cs
- CodeObject.cs
- TextPenaltyModule.cs
- RegularExpressionValidator.cs
- WebPartConnectionsCancelVerb.cs
- EventRouteFactory.cs
- LinqDataSource.cs
- Pkcs7Signer.cs
- Random.cs
- TextDecorations.cs
- Constants.cs
- CodeArgumentReferenceExpression.cs
- XmlElementList.cs
- CatalogZoneBase.cs
- DataGridState.cs
- ReturnValue.cs
- EntityDataSourceSelectingEventArgs.cs
- SystemResources.cs
- EraserBehavior.cs
- PipeConnection.cs
- ParameterCollection.cs
- RepeatBehaviorConverter.cs
- FileStream.cs
- Boolean.cs
- TraceContextEventArgs.cs
- ThrowHelper.cs
- References.cs
- BaseResourcesBuildProvider.cs
- XmlSchemaDatatype.cs
- DaylightTime.cs
- TraceRecord.cs
- HtmlToClrEventProxy.cs
- SiteMapProvider.cs
- AppSecurityManager.cs
- RightsManagementInformation.cs
- Sentence.cs
- exports.cs
- MaskedTextProvider.cs
- NonVisualControlAttribute.cs
- OdbcCommandBuilder.cs
- ErrorProvider.cs
- Table.cs
- MergePropertyDescriptor.cs
- ITreeGenerator.cs
- IdentityReference.cs
- XmlIlVisitor.cs
- InputScopeNameConverter.cs
- LogicalChannel.cs
- BaseDataBoundControlDesigner.cs
- Dispatcher.cs
- NetMsmqSecurityMode.cs
- ProfileService.cs
- Int32Rect.cs
- ColumnWidthChangedEvent.cs
- XmlRawWriterWrapper.cs
- NativeMethods.cs
- ReliableChannelFactory.cs
- Point3DCollectionConverter.cs
- OdbcConnectionFactory.cs
- CoTaskMemHandle.cs
- StringToken.cs
- SemaphoreSlim.cs
- ContextProperty.cs
- MappingException.cs
- SrgsGrammar.cs
- CollectionViewSource.cs
- CustomWebEventKey.cs
- TemplateFactory.cs
- AdornerDecorator.cs
- EntityContainerEntitySetDefiningQuery.cs
- CommandID.cs
- AuthStoreRoleProvider.cs
- Stream.cs
- SQLInt32.cs
- EndpointNameMessageFilter.cs
- DataGridCellAutomationPeer.cs
- DataGridHeaderBorder.cs
- TrustManagerPromptUI.cs
- SelectingProviderEventArgs.cs
- TabItemAutomationPeer.cs
- LogAppendAsyncResult.cs
- XPathParser.cs
- DesignerActionUIService.cs
- CrossAppDomainChannel.cs
- IndentedWriter.cs