Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / ui / webcontrols / DataPagerFieldCollection.cs / 1 / DataPagerFieldCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Web;
using System.Web.Resources;
using System.Web.Security;
using System.Web.UI;
namespace System.Web.UI.WebControls {
///
/// Summary description for DataPagerFieldCollection
///
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class DataPagerFieldCollection : StateManagedCollection {
private DataPager _dataPager;
private static readonly Type[] knownTypes = new Type[] {
typeof(NextPreviousPagerField),
typeof(NumericPagerField),
typeof(TemplatePagerField)
};
public event EventHandler FieldsChanged;
public DataPagerFieldCollection(DataPager dataPager) {
_dataPager = dataPager;
}
///
/// Gets a at the specified index in the
/// collection.
///
[
Browsable(false)
]
public DataPagerField this[int index] {
get {
return ((IList)this)[index] as DataPagerField;
}
}
///
/// Appends a to the collection.
///
public void Add(DataPagerField field) {
((IList)this).Add(field);
}
///
/// Provides a deep copy of the collection. Used mainly by design time dialogs to implement "cancel" rollback behavior.
///
public DataPagerFieldCollection CloneFields(DataPager pager) {
DataPagerFieldCollection fields = new DataPagerFieldCollection(pager);
foreach (DataPagerField field in this) {
fields.Add(field.CloneField());
}
return fields;
}
///
/// Returns whether a DataPagerField is a member of the collection.
///
public bool Contains(DataPagerField field) {
return ((IList)this).Contains(field);
}
///
/// Copies the contents of the entire collection into an appending at
/// the specified index of the .
///
public void CopyTo(DataPagerField[] array, int index) {
((IList)this).CopyTo(array, index);
return;
}
///
/// Creates a known type of DataPagerField.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new NextPreviousPagerField();
case 1:
return new NumericPagerField();
case 2:
return new TemplatePagerField();
default:
throw new ArgumentOutOfRangeException(AtlasWeb.PagerFieldCollection_InvalidTypeIndex);
}
}
///
/// Returns an ArrayList of known DataPagerField types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Returns the index of the first occurrence of a value in a .
///
public int IndexOf(DataPagerField field) {
return ((IList)this).IndexOf(field);
}
///
/// Inserts a to the collection
/// at the specified index.
///
public void Insert(int index, DataPagerField field) {
((IList)this).Insert(index, field);
}
///
/// Called when the Clear() method is complete.
///
protected override void OnClearComplete() {
OnFieldsChanged();
}
///
///
void OnFieldChanged(object sender, EventArgs e) {
OnFieldsChanged();
}
///
///
void OnFieldsChanged() {
if (FieldsChanged != null) {
FieldsChanged(this, EventArgs.Empty);
}
}
///
/// Called when the Insert() method is complete.
///
protected override void OnInsertComplete(int index, object value) {
DataPagerField field = value as DataPagerField;
if (field != null) {
field.FieldChanged += new EventHandler(OnFieldChanged);
}
field.SetDataPager(_dataPager);
OnFieldsChanged();
}
///
/// Called when the Remove() method is complete.
///
protected override void OnRemoveComplete(int index, object value) {
DataPagerField field = value as DataPagerField;
if (field != null) {
field.FieldChanged -= new EventHandler(OnFieldChanged);
}
OnFieldsChanged();
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is DataPagerField))
throw new ArgumentException(AtlasWeb.PagerFieldCollection_InvalidType);
}
///
/// Removes a from the collection at the specified
/// index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Removes the specified from the collection.
///
public void Remove(DataPagerField field) {
((IList)this).Remove(field);
}
///
/// Marks a DataPagerField as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((DataPagerField)o).SetDirty();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Web;
using System.Web.Resources;
using System.Web.Security;
using System.Web.UI;
namespace System.Web.UI.WebControls {
///
/// Summary description for DataPagerFieldCollection
///
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class DataPagerFieldCollection : StateManagedCollection {
private DataPager _dataPager;
private static readonly Type[] knownTypes = new Type[] {
typeof(NextPreviousPagerField),
typeof(NumericPagerField),
typeof(TemplatePagerField)
};
public event EventHandler FieldsChanged;
public DataPagerFieldCollection(DataPager dataPager) {
_dataPager = dataPager;
}
///
/// Gets a at the specified index in the
/// collection.
///
[
Browsable(false)
]
public DataPagerField this[int index] {
get {
return ((IList)this)[index] as DataPagerField;
}
}
///
/// Appends a to the collection.
///
public void Add(DataPagerField field) {
((IList)this).Add(field);
}
///
/// Provides a deep copy of the collection. Used mainly by design time dialogs to implement "cancel" rollback behavior.
///
public DataPagerFieldCollection CloneFields(DataPager pager) {
DataPagerFieldCollection fields = new DataPagerFieldCollection(pager);
foreach (DataPagerField field in this) {
fields.Add(field.CloneField());
}
return fields;
}
///
/// Returns whether a DataPagerField is a member of the collection.
///
public bool Contains(DataPagerField field) {
return ((IList)this).Contains(field);
}
///
/// Copies the contents of the entire collection into an appending at
/// the specified index of the .
///
public void CopyTo(DataPagerField[] array, int index) {
((IList)this).CopyTo(array, index);
return;
}
///
/// Creates a known type of DataPagerField.
///
protected override object CreateKnownType(int index) {
switch (index) {
case 0:
return new NextPreviousPagerField();
case 1:
return new NumericPagerField();
case 2:
return new TemplatePagerField();
default:
throw new ArgumentOutOfRangeException(AtlasWeb.PagerFieldCollection_InvalidTypeIndex);
}
}
///
/// Returns an ArrayList of known DataPagerField types.
///
protected override Type[] GetKnownTypes() {
return knownTypes;
}
///
/// Returns the index of the first occurrence of a value in a .
///
public int IndexOf(DataPagerField field) {
return ((IList)this).IndexOf(field);
}
///
/// Inserts a to the collection
/// at the specified index.
///
public void Insert(int index, DataPagerField field) {
((IList)this).Insert(index, field);
}
///
/// Called when the Clear() method is complete.
///
protected override void OnClearComplete() {
OnFieldsChanged();
}
///
///
void OnFieldChanged(object sender, EventArgs e) {
OnFieldsChanged();
}
///
///
void OnFieldsChanged() {
if (FieldsChanged != null) {
FieldsChanged(this, EventArgs.Empty);
}
}
///
/// Called when the Insert() method is complete.
///
protected override void OnInsertComplete(int index, object value) {
DataPagerField field = value as DataPagerField;
if (field != null) {
field.FieldChanged += new EventHandler(OnFieldChanged);
}
field.SetDataPager(_dataPager);
OnFieldsChanged();
}
///
/// Called when the Remove() method is complete.
///
protected override void OnRemoveComplete(int index, object value) {
DataPagerField field = value as DataPagerField;
if (field != null) {
field.FieldChanged -= new EventHandler(OnFieldChanged);
}
OnFieldsChanged();
}
///
/// Validates that an object is a HotSpot.
///
protected override void OnValidate(object o) {
base.OnValidate(o);
if (!(o is DataPagerField))
throw new ArgumentException(AtlasWeb.PagerFieldCollection_InvalidType);
}
///
/// Removes a from the collection at the specified
/// index.
///
public void RemoveAt(int index) {
((IList)this).RemoveAt(index);
}
///
/// Removes the specified from the collection.
///
public void Remove(DataPagerField field) {
((IList)this).Remove(field);
}
///
/// Marks a DataPagerField as dirty so that it will record its entire state into view state.
///
protected override void SetDirtyObject(object o) {
((DataPagerField)o).SetDirty();
}
}
}
// 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
- OutOfMemoryException.cs
- SharedStatics.cs
- IncrementalHitTester.cs
- DataGridViewLayoutData.cs
- XmlSignificantWhitespace.cs
- GenericUI.cs
- MobileUserControl.cs
- TreeView.cs
- DeleteHelper.cs
- PropertyItem.cs
- ExpressionConverter.cs
- TextParaLineResult.cs
- ForEach.cs
- XPathNodePointer.cs
- Substitution.cs
- XmlProcessingInstruction.cs
- BinaryFormatterWriter.cs
- ToolBarPanel.cs
- KeyValuePairs.cs
- XmlEntity.cs
- IndexedString.cs
- AmbientValueAttribute.cs
- CircleHotSpot.cs
- DataControlImageButton.cs
- CalendarAutomationPeer.cs
- HyperLink.cs
- DependencyObjectType.cs
- ClientTargetCollection.cs
- ButtonBaseAutomationPeer.cs
- ConnectionPoint.cs
- XsltLoader.cs
- OrthographicCamera.cs
- StrokeSerializer.cs
- IsolatedStoragePermission.cs
- SocketElement.cs
- InteropExecutor.cs
- Splitter.cs
- Run.cs
- DataGridPagerStyle.cs
- CodeGeneratorOptions.cs
- BuildTopDownAttribute.cs
- OperationAbortedException.cs
- ForeignKeyFactory.cs
- Panel.cs
- CounterNameConverter.cs
- URLString.cs
- CheckBoxAutomationPeer.cs
- TextDecoration.cs
- Model3DGroup.cs
- Transform.cs
- WithStatement.cs
- DesignerAttribute.cs
- PKCS1MaskGenerationMethod.cs
- AsyncOperation.cs
- DesignerTextBoxAdapter.cs
- Classification.cs
- ComponentSerializationService.cs
- GeometryCollection.cs
- DetailsViewActionList.cs
- DodSequenceMerge.cs
- EnvironmentPermission.cs
- ThemeDirectoryCompiler.cs
- DuplicateWaitObjectException.cs
- __TransparentProxy.cs
- XmlSchemaObject.cs
- messageonlyhwndwrapper.cs
- ResumeStoryboard.cs
- OleDbRowUpdatedEvent.cs
- RegularExpressionValidator.cs
- ContentDisposition.cs
- SqlTransaction.cs
- KeyValuePair.cs
- PropertyPathConverter.cs
- ServiceProviders.cs
- DateTimeOffsetStorage.cs
- MulticastDelegate.cs
- SharedStatics.cs
- PageCatalogPart.cs
- CryptoStream.cs
- SHA512.cs
- PropertyDescriptor.cs
- ContentIterators.cs
- EventLogPermission.cs
- BreakRecordTable.cs
- SpotLight.cs
- SymLanguageVendor.cs
- DynamicRendererThreadManager.cs
- ObjectComplexPropertyMapping.cs
- TextRunCacheImp.cs
- Header.cs
- PlainXmlDeserializer.cs
- UnsafeNativeMethods.cs
- Gdiplus.cs
- IdentityNotMappedException.cs
- SpellerStatusTable.cs
- Parameter.cs
- X509CertificateTrustedIssuerElement.cs
- DataControlFieldCollection.cs
- DataGridLengthConverter.cs
- TemplateNameScope.cs