Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / DataControlFieldCollection.cs / 1 / DataControlFieldCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Security.Permissions; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class DataControlFieldCollection : StateManagedCollection { private static readonly Type[] knownTypes = new Type[] { typeof(BoundField), typeof(ButtonField), typeof(CheckBoxField), typeof(CommandField), typeof(HyperLinkField), typeof(ImageField), typeof(TemplateField) }; public event EventHandler FieldsChanged; ///Represents the collection of fields to be displayed in /// a data bound control that uses fields. ////// [ Browsable(false) ] public DataControlField this[int index] { get { return ((IList)this)[index] as DataControlField; } } ///Gets a ///at the specified index in the /// collection. /// public void Add(DataControlField field) { ((IList)this).Add(field); } ///Appends a ///to the collection. /// public DataControlFieldCollection CloneFields() { DataControlFieldCollection fields = new DataControlFieldCollection(); foreach (DataControlField 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(DataControlField field) { return ((IList)this).Contains(field); } ///Returns whether a DataControlField is a member of the collection. ////// public void CopyTo(DataControlField[] 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 BoundField(); case 1: return new ButtonField(); case 2: return new CheckBoxField(); case 3: return new CommandField(); case 4: return new HyperLinkField(); case 5: return new ImageField(); case 6: return new TemplateField(); default: throw new ArgumentOutOfRangeException(SR.GetString(SR.DataControlFieldCollection_InvalidTypeIndex)); } } ///Creates a known type of DataControlField. ////// protected override Type[] GetKnownTypes() { return knownTypes; } ///Returns an ArrayList of known DataControlField types. ////// public int IndexOf(DataControlField field) { return ((IList)this).IndexOf(field); } ///Returns the index of the first occurrence of a value in a ///. /// public void Insert(int index, DataControlField 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) { DataControlField field = value as DataControlField; if (field != null) { field.FieldChanged += new EventHandler(OnFieldChanged); } OnFieldsChanged(); } ////// Called when the Remove() method is complete. /// protected override void OnRemoveComplete(int index, object value) { DataControlField field = value as DataControlField; if (field != null) { field.FieldChanged -= new EventHandler(OnFieldChanged); } OnFieldsChanged(); } ////// protected override void OnValidate(object o) { base.OnValidate(o); if (!(o is DataControlField)) throw new ArgumentException(SR.GetString(SR.DataControlFieldCollection_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(DataControlField field) { ((IList)this).Remove(field); } ///Removes the specified ///from the collection. /// protected override void SetDirtyObject(object o) { ((DataControlField)o).SetDirty(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //Marks a DataControlField as dirty so that it will record its entire state into view state. ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Security.Permissions; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class DataControlFieldCollection : StateManagedCollection { private static readonly Type[] knownTypes = new Type[] { typeof(BoundField), typeof(ButtonField), typeof(CheckBoxField), typeof(CommandField), typeof(HyperLinkField), typeof(ImageField), typeof(TemplateField) }; public event EventHandler FieldsChanged; ///Represents the collection of fields to be displayed in /// a data bound control that uses fields. ////// [ Browsable(false) ] public DataControlField this[int index] { get { return ((IList)this)[index] as DataControlField; } } ///Gets a ///at the specified index in the /// collection. /// public void Add(DataControlField field) { ((IList)this).Add(field); } ///Appends a ///to the collection. /// public DataControlFieldCollection CloneFields() { DataControlFieldCollection fields = new DataControlFieldCollection(); foreach (DataControlField 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(DataControlField field) { return ((IList)this).Contains(field); } ///Returns whether a DataControlField is a member of the collection. ////// public void CopyTo(DataControlField[] 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 BoundField(); case 1: return new ButtonField(); case 2: return new CheckBoxField(); case 3: return new CommandField(); case 4: return new HyperLinkField(); case 5: return new ImageField(); case 6: return new TemplateField(); default: throw new ArgumentOutOfRangeException(SR.GetString(SR.DataControlFieldCollection_InvalidTypeIndex)); } } ///Creates a known type of DataControlField. ////// protected override Type[] GetKnownTypes() { return knownTypes; } ///Returns an ArrayList of known DataControlField types. ////// public int IndexOf(DataControlField field) { return ((IList)this).IndexOf(field); } ///Returns the index of the first occurrence of a value in a ///. /// public void Insert(int index, DataControlField 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) { DataControlField field = value as DataControlField; if (field != null) { field.FieldChanged += new EventHandler(OnFieldChanged); } OnFieldsChanged(); } ////// Called when the Remove() method is complete. /// protected override void OnRemoveComplete(int index, object value) { DataControlField field = value as DataControlField; if (field != null) { field.FieldChanged -= new EventHandler(OnFieldChanged); } OnFieldsChanged(); } ////// protected override void OnValidate(object o) { base.OnValidate(o); if (!(o is DataControlField)) throw new ArgumentException(SR.GetString(SR.DataControlFieldCollection_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(DataControlField field) { ((IList)this).Remove(field); } ///Removes the specified ///from the collection. /// protected override void SetDirtyObject(object o) { ((DataControlField)o).SetDirty(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Marks a DataControlField 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
- WebPartPersonalization.cs
- BaseCollection.cs
- LazyInitializer.cs
- SpotLight.cs
- XPathScanner.cs
- PositiveTimeSpanValidator.cs
- RequiredFieldValidator.cs
- SymbolMethod.cs
- ChtmlTextWriter.cs
- xmlfixedPageInfo.cs
- RotateTransform3D.cs
- BooleanFunctions.cs
- TraceFilter.cs
- RemoteWebConfigurationHostServer.cs
- EntityContainer.cs
- ImportedNamespaceContextItem.cs
- DataGridViewControlCollection.cs
- DSACryptoServiceProvider.cs
- PeerTransportListenAddressValidatorAttribute.cs
- ReaderContextStackData.cs
- CapabilitiesAssignment.cs
- XsdCachingReader.cs
- OutputCacheSettings.cs
- QueryCacheEntry.cs
- PageContentCollection.cs
- _FtpControlStream.cs
- MimeImporter.cs
- MethodRental.cs
- InvokeHandlers.cs
- GeometryCollection.cs
- SignatureHelper.cs
- TextBoxBase.cs
- _IPv6Address.cs
- SqlGenericUtil.cs
- XmlTypeMapping.cs
- DataBinder.cs
- WebPartVerb.cs
- SamlAssertionKeyIdentifierClause.cs
- InkPresenterAutomationPeer.cs
- StructuredTypeEmitter.cs
- OpCodes.cs
- MonthCalendar.cs
- RelationshipEndCollection.cs
- CorrelationManager.cs
- BaseValidator.cs
- DataPointer.cs
- StringOutput.cs
- FastEncoder.cs
- RSAProtectedConfigurationProvider.cs
- SettingsAttributeDictionary.cs
- ButtonRenderer.cs
- ModuleBuilder.cs
- FixedHyperLink.cs
- XmlParserContext.cs
- AssemblyInfo.cs
- XmlTextReader.cs
- NumericUpDown.cs
- ToolStripComboBox.cs
- ModuleBuilderData.cs
- AnnotationResourceChangedEventArgs.cs
- RegionIterator.cs
- CodeDOMProvider.cs
- DeflateStream.cs
- ECDsaCng.cs
- DragCompletedEventArgs.cs
- XmlNodeList.cs
- SqlBuilder.cs
- ViewManager.cs
- InternalPolicyElement.cs
- DataServiceQueryContinuation.cs
- ReceiveReply.cs
- UnsafeNativeMethodsCLR.cs
- LocationReference.cs
- DragCompletedEventArgs.cs
- HttpPostedFile.cs
- NonDualMessageSecurityOverHttpElement.cs
- DefaultAuthorizationContext.cs
- MSAAWinEventWrap.cs
- SafeLibraryHandle.cs
- UserNamePasswordValidator.cs
- XPathMultyIterator.cs
- ConnectionConsumerAttribute.cs
- TemplateControlCodeDomTreeGenerator.cs
- xml.cs
- SqlSupersetValidator.cs
- ComboBoxItem.cs
- WebPartManagerInternals.cs
- ADMembershipProvider.cs
- ObjRef.cs
- ToolStripDropDownItem.cs
- ItemsControl.cs
- StrongNamePublicKeyBlob.cs
- ManipulationStartingEventArgs.cs
- PeerPresenceInfo.cs
- QueryStringHandler.cs
- Calendar.cs
- FileEnumerator.cs
- ExtensionDataReader.cs
- SByteConverter.cs
- AsymmetricKeyExchangeFormatter.cs