Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / DataPagerFieldCollection.cs / 1305376 / 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 /// 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; } ////// [ Browsable(false) ] public DataPagerField this[int index] { get { return ((IList)this)[index] as DataPagerField; } } ///Gets a ///at the specified index in the /// collection. /// public void Add(DataPagerField field) { ((IList)this).Add(field); } ///Appends a ///to the collection. /// public DataPagerFieldCollection CloneFields(DataPager pager) { DataPagerFieldCollection fields = new DataPagerFieldCollection(pager); foreach (DataPagerField field in this) { fields.Add(field.CloneField()); } return fields; } ///Provides a deep copy of the collection. Used mainly by design time dialogs to implement "cancel" rollback behavior. ////// public bool Contains(DataPagerField field) { return ((IList)this).Contains(field); } ///Returns whether a DataPagerField is a member of the collection. ////// public void CopyTo(DataPagerField[] array, int index) { ((IList)this).CopyTo(array, index); return; } ///Copies the contents of the entire collection into an ///appending at /// the specified index of the . /// 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); } } ///Creates a known type of DataPagerField. ////// protected override Type[] GetKnownTypes() { return knownTypes; } ///Returns an ArrayList of known DataPagerField types. ////// public int IndexOf(DataPagerField field) { return ((IList)this).IndexOf(field); } ///Returns the index of the first occurrence of a value in a ///. /// public void Insert(int index, DataPagerField field) { ((IList)this).Insert(index, field); } ///Inserts a ///to the collection /// at the specified index. /// 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(); } ////// protected override void OnValidate(object o) { base.OnValidate(o); if (!(o is DataPagerField)) throw new ArgumentException(AtlasWeb.PagerFieldCollection_InvalidType); } ///Validates that an object is a HotSpot. ////// public void RemoveAt(int index) { ((IList)this).RemoveAt(index); } ///Removes a ///from the collection at the specified /// index. /// public void Remove(DataPagerField field) { ((IList)this).Remove(field); } ///Removes the specified ///from the collection. /// protected override void SetDirtyObject(object o) { ((DataPagerField)o).SetDirty(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //Marks a DataPagerField as dirty so that it will record its entire state into view state. ///// 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 /// 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; } ////// [ Browsable(false) ] public DataPagerField this[int index] { get { return ((IList)this)[index] as DataPagerField; } } ///Gets a ///at the specified index in the /// collection. /// public void Add(DataPagerField field) { ((IList)this).Add(field); } ///Appends a ///to the collection. /// public DataPagerFieldCollection CloneFields(DataPager pager) { DataPagerFieldCollection fields = new DataPagerFieldCollection(pager); foreach (DataPagerField field in this) { fields.Add(field.CloneField()); } return fields; } ///Provides a deep copy of the collection. Used mainly by design time dialogs to implement "cancel" rollback behavior. ////// public bool Contains(DataPagerField field) { return ((IList)this).Contains(field); } ///Returns whether a DataPagerField is a member of the collection. ////// public void CopyTo(DataPagerField[] array, int index) { ((IList)this).CopyTo(array, index); return; } ///Copies the contents of the entire collection into an ///appending at /// the specified index of the . /// 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); } } ///Creates a known type of DataPagerField. ////// protected override Type[] GetKnownTypes() { return knownTypes; } ///Returns an ArrayList of known DataPagerField types. ////// public int IndexOf(DataPagerField field) { return ((IList)this).IndexOf(field); } ///Returns the index of the first occurrence of a value in a ///. /// public void Insert(int index, DataPagerField field) { ((IList)this).Insert(index, field); } ///Inserts a ///to the collection /// at the specified index. /// 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(); } ////// protected override void OnValidate(object o) { base.OnValidate(o); if (!(o is DataPagerField)) throw new ArgumentException(AtlasWeb.PagerFieldCollection_InvalidType); } ///Validates that an object is a HotSpot. ////// public void RemoveAt(int index) { ((IList)this).RemoveAt(index); } ///Removes a ///from the collection at the specified /// index. /// public void Remove(DataPagerField field) { ((IList)this).Remove(field); } ///Removes the specified ///from the collection. /// protected override void SetDirtyObject(object o) { ((DataPagerField)o).SetDirty(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Marks a DataPagerField as dirty so that it will record its entire state into view state. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IsolatedStorage.cs
- FlowPosition.cs
- DupHandleConnectionReader.cs
- util.cs
- HttpApplicationFactory.cs
- AttributeAction.cs
- SerializationFieldInfo.cs
- MetaData.cs
- FontWeightConverter.cs
- MappableObjectManager.cs
- MdbDataFileEditor.cs
- BackEase.cs
- WebResourceUtil.cs
- DoubleLink.cs
- ActivityBindForm.cs
- httpserverutility.cs
- FunctionDefinition.cs
- XamlSerializerUtil.cs
- JavaScriptSerializer.cs
- LayoutEvent.cs
- SqlCacheDependencyDatabase.cs
- XhtmlBasicSelectionListAdapter.cs
- ActiveDocumentEvent.cs
- Module.cs
- ResourcePool.cs
- EntityObject.cs
- DynamicMethod.cs
- ProfileEventArgs.cs
- ListViewEditEventArgs.cs
- GenericsInstances.cs
- LateBoundBitmapDecoder.cs
- ValidatedControlConverter.cs
- WebPartTransformer.cs
- XPathScanner.cs
- coordinatorfactory.cs
- TextBox.cs
- LoginView.cs
- PropertyChangedEventArgs.cs
- WFItemsToSpacerVisibility.cs
- DbProviderFactories.cs
- DataException.cs
- Ticks.cs
- ObjectSecurity.cs
- TransformerTypeCollection.cs
- ViewStateModeByIdAttribute.cs
- xsdvalidator.cs
- GridViewUpdateEventArgs.cs
- PkcsMisc.cs
- EpmHelper.cs
- EventDescriptorCollection.cs
- Int64.cs
- SessionIDManager.cs
- DbSource.cs
- TemplateLookupAction.cs
- DataGridViewComboBoxCell.cs
- PropertyGeneratedEventArgs.cs
- COM2ComponentEditor.cs
- linebase.cs
- EncryptedPackage.cs
- HtmlFormAdapter.cs
- ClientScriptManager.cs
- PrinterUnitConvert.cs
- SqlReorderer.cs
- DataGridTemplateColumn.cs
- Models.cs
- _NestedSingleAsyncResult.cs
- GeometryModel3D.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- WebPartActionVerb.cs
- LicFileLicenseProvider.cs
- RayHitTestParameters.cs
- ParameterReplacerVisitor.cs
- Operator.cs
- ZoneLinkButton.cs
- QilTargetType.cs
- HtmlWindowCollection.cs
- GlyphShapingProperties.cs
- TimeSpanConverter.cs
- BinaryVersion.cs
- ButtonPopupAdapter.cs
- Mutex.cs
- RootBuilder.cs
- GetWinFXPath.cs
- SelectedCellsChangedEventArgs.cs
- SqlLiftWhereClauses.cs
- PolyBezierSegmentFigureLogic.cs
- SqlTypesSchemaImporter.cs
- WhitespaceRuleReader.cs
- NullableDoubleSumAggregationOperator.cs
- FieldNameLookup.cs
- MinMaxParagraphWidth.cs
- SqlClientWrapperSmiStream.cs
- WorkflowTimerService.cs
- TemplateContainer.cs
- sqlstateclientmanager.cs
- DependencyPropertyAttribute.cs
- DiffuseMaterial.cs
- SafeThreadHandle.cs
- ProxyGenerator.cs
- SHA1Managed.cs