Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / DataControlImageButton.cs / 1305376 / DataControlImageButton.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 ImageButton used within a DataControl.
///
[SupportsEventValidation]
internal sealed class DataControlImageButton : ImageButton {
IPostBackContainer _container;
string _callbackArgument;
bool _enableCallback;
internal DataControlImageButton(IPostBackContainer container) {
_container = container;
}
public override bool CausesValidation {
get {
return false;
}
set {
throw new NotSupportedException(SR.GetString(SR.CannotSetValidationOnDataControlButtons));
}
}
internal void EnableCallback(string argument) {
_enableCallback = true;
_callbackArgument = argument;
}
protected sealed override PostBackOptions GetPostBackOptions() {
if (_container != null) {
return _container.GetPostBackOptions(this);
}
return base.GetPostBackOptions();
}
protected internal override void Render(HtmlTextWriter writer) {
SetCallbackProperties();
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;
}
}
}
}
}
}
// 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 ImageButton used within a DataControl.
///
[SupportsEventValidation]
internal sealed class DataControlImageButton : ImageButton {
IPostBackContainer _container;
string _callbackArgument;
bool _enableCallback;
internal DataControlImageButton(IPostBackContainer container) {
_container = container;
}
public override bool CausesValidation {
get {
return false;
}
set {
throw new NotSupportedException(SR.GetString(SR.CannotSetValidationOnDataControlButtons));
}
}
internal void EnableCallback(string argument) {
_enableCallback = true;
_callbackArgument = argument;
}
protected sealed override PostBackOptions GetPostBackOptions() {
if (_container != null) {
return _container.GetPostBackOptions(this);
}
return base.GetPostBackOptions();
}
protected internal override void Render(HtmlTextWriter writer) {
SetCallbackProperties();
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;
}
}
}
}
}
}
// 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
- PostBackTrigger.cs
- User.cs
- BindingGraph.cs
- XmlSchemaInclude.cs
- IBuiltInEvidence.cs
- AssociationSetEnd.cs
- GetPageCompletedEventArgs.cs
- ArrowControl.xaml.cs
- ListControlConvertEventArgs.cs
- TransactionTraceIdentifier.cs
- AnnouncementEndpoint.cs
- DesignTimeTemplateParser.cs
- ClaimComparer.cs
- BindingExpression.cs
- ServiceDescriptionImporter.cs
- XDRSchema.cs
- XmlSchemaSet.cs
- ComplexBindingPropertiesAttribute.cs
- CodeTypeParameterCollection.cs
- PreviewPageInfo.cs
- ToolStripScrollButton.cs
- FixedPageStructure.cs
- arabicshape.cs
- ObjectReferenceStack.cs
- PriorityBinding.cs
- XmlValueConverter.cs
- WizardStepBase.cs
- EnterpriseServicesHelper.cs
- BindingRestrictions.cs
- DateTimeFormatInfo.cs
- ContentDisposition.cs
- AnchorEditor.cs
- Privilege.cs
- PropertyEmitter.cs
- PathFigureCollectionConverter.cs
- HtmlInputSubmit.cs
- CodeTypeMember.cs
- ControlPropertyNameConverter.cs
- PassportAuthenticationModule.cs
- ApplicationFileCodeDomTreeGenerator.cs
- CapabilitiesPattern.cs
- ImageSourceConverter.cs
- ImageAttributes.cs
- SizeIndependentAnimationStorage.cs
- DateBoldEvent.cs
- DocumentApplicationState.cs
- RectangleHotSpot.cs
- CompiledXpathExpr.cs
- TypeUtil.cs
- SystemNetworkInterface.cs
- ProfessionalColors.cs
- SystemBrushes.cs
- WebDescriptionAttribute.cs
- Material.cs
- UidPropertyAttribute.cs
- DependentList.cs
- SendMailErrorEventArgs.cs
- SemanticResolver.cs
- FileLoadException.cs
- PersonalizationStateQuery.cs
- StringUtil.cs
- cookieexception.cs
- Keywords.cs
- XamlPointCollectionSerializer.cs
- WebPartDeleteVerb.cs
- RegexReplacement.cs
- MimeWriter.cs
- InnerItemCollectionView.cs
- ReadOnlyDataSourceView.cs
- FileSecurity.cs
- OledbConnectionStringbuilder.cs
- FillErrorEventArgs.cs
- LoginName.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- DataColumn.cs
- WeakReference.cs
- TableAutomationPeer.cs
- LingerOption.cs
- _AutoWebProxyScriptEngine.cs
- SizeIndependentAnimationStorage.cs
- ReadOnlyHierarchicalDataSourceView.cs
- WCFBuildProvider.cs
- FileChangesMonitor.cs
- EntityDataSourceStatementEditorForm.cs
- PointUtil.cs
- MissingMemberException.cs
- InkCanvasSelectionAdorner.cs
- webbrowsersite.cs
- ControlIdConverter.cs
- ServiceOperationParameter.cs
- LayoutTableCell.cs
- UrlMappingsModule.cs
- ReliabilityContractAttribute.cs
- BaseTreeIterator.cs
- DecoderNLS.cs
- SHA256Managed.cs
- _LocalDataStoreMgr.cs
- Underline.cs
- MsmqQueue.cs
- DataSource.cs