Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / DropDownList.cs / 3 / DropDownList.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Collections.Specialized; using System.Drawing; using System.Web; using System.Web.UI; using System.Web.UI.WebControls.Adapters; using System.Security.Permissions; ////// [ SupportsEventValidation, ValidationProperty("SelectedItem") ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class DropDownList : ListControl, IPostBackDataHandler { ///Creates a control that allows the user to select a single item from a /// drop-down list. ////// public DropDownList() { } ///Initializes a new instance of the ///class. /// [ Browsable(false) ] public override Color BorderColor { get { return base.BorderColor; } set { base.BorderColor = value; } } ///[To be supplied.] ////// [ Browsable(false) ] public override BorderStyle BorderStyle { get { return base.BorderStyle; } set { base.BorderStyle = value; } } ///[To be supplied.] ////// [ Browsable(false) ] public override Unit BorderWidth { get { return base.BorderWidth; } set { base.BorderWidth = value; } } ///[To be supplied.] ////// [ WebCategory("Behavior"), DefaultValue(0), WebSysDescription(SR.WebControl_SelectedIndex), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) ] public override int SelectedIndex { get { int selectedIndex = base.SelectedIndex; if (selectedIndex < 0 && Items.Count > 0) { Items[0].Selected = true; selectedIndex = 0; } return selectedIndex; } set { base.SelectedIndex = value; } } internal override ArrayList SelectedIndicesInternal { get { int sideEffect = SelectedIndex; return base.SelectedIndicesInternal; } } protected override void AddAttributesToRender(HtmlTextWriter writer) { string uniqueID = UniqueID; if (uniqueID != null) { writer.AddAttribute(HtmlTextWriterAttribute.Name, uniqueID); } base.AddAttributesToRender(writer); } protected override ControlCollection CreateControlCollection() { return new EmptyControlCollection(this); } ///Gets or sets the index of the item selected by the user /// from the ////// control. /// /// bool IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) { return LoadPostData(postDataKey, postCollection); } ///Process posted data for the ///control. /// /// protected virtual bool LoadPostData(String postDataKey, NameValueCollection postCollection) { // When a DropDownList is disabled, then there is no postback data for it. // Since DropDownList doesn't call RegisterRequiresPostBack, this method will // never be called, so we don't need to worry about ignoring empty postback data. string [] selectedItems = postCollection.GetValues(postDataKey); EnsureDataBound(); if (selectedItems != null) { ValidateEvent(postDataKey, selectedItems[0]); int n = Items.FindByValueInternal(selectedItems[0], false); if (SelectedIndex != n) { SetPostDataSelection(n); return true; } } return false; } ///Process posted data for the ///control. /// /// void IPostBackDataHandler.RaisePostDataChangedEvent() { RaisePostDataChangedEvent(); } ///Raises events for the ///control on post back. /// /// protected virtual void RaisePostDataChangedEvent() { if (AutoPostBack && !Page.IsPostBackEventControlRegistered) { // Page.AutoPostBackControl = this; if (CausesValidation) { Page.Validate(ValidationGroup); } } OnSelectedIndexChanged(EventArgs.Empty); } protected internal override void VerifyMultiSelect() { throw new HttpException(SR.GetString(SR.Cant_Multiselect, "DropDownList")); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.Raises events for the ///control on post back.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExtendedPropertyDescriptor.cs
- XPathEmptyIterator.cs
- XmlAggregates.cs
- Brushes.cs
- SerializationException.cs
- SendMailErrorEventArgs.cs
- DocComment.cs
- ConnectionPoint.cs
- StrokeDescriptor.cs
- FormatterServices.cs
- SelectionItemPattern.cs
- XmlDocumentFragment.cs
- HttpRuntime.cs
- TextBlockAutomationPeer.cs
- ScalarOps.cs
- InsufficientMemoryException.cs
- SchemaExporter.cs
- SpecialFolderEnumConverter.cs
- HtmlGenericControl.cs
- Stacktrace.cs
- WebPageTraceListener.cs
- DrawingContextDrawingContextWalker.cs
- Trigger.cs
- InvokeMethodActivity.cs
- SqlCacheDependencySection.cs
- Section.cs
- Bitmap.cs
- basecomparevalidator.cs
- DataListItemCollection.cs
- BinHexDecoder.cs
- SplitterEvent.cs
- DbConnectionStringCommon.cs
- WebPartConnectionsConnectVerb.cs
- StylusButtonCollection.cs
- IUnknownConstantAttribute.cs
- DictionarySectionHandler.cs
- ListViewItemSelectionChangedEvent.cs
- ModelFunctionTypeElement.cs
- WindowsImpersonationContext.cs
- BinHexDecoder.cs
- SetterBaseCollection.cs
- DefaultBindingPropertyAttribute.cs
- SQLByteStorage.cs
- GroupedContextMenuStrip.cs
- XmlAtomicValue.cs
- safesecurityhelperavalon.cs
- EventLogTraceListener.cs
- AbsoluteQuery.cs
- CallbackException.cs
- TypeUnloadedException.cs
- OdbcStatementHandle.cs
- CryptoApi.cs
- HttpModulesInstallComponent.cs
- WrappedIUnknown.cs
- Int16AnimationUsingKeyFrames.cs
- HostedImpersonationContext.cs
- FileLoadException.cs
- ThaiBuddhistCalendar.cs
- SqlUserDefinedAggregateAttribute.cs
- OdbcConnection.cs
- CreatingCookieEventArgs.cs
- WmlPageAdapter.cs
- updatecommandorderer.cs
- HideDisabledControlAdapter.cs
- ExpressionReplacer.cs
- ScrollEvent.cs
- ViewCellRelation.cs
- BrowserDefinition.cs
- Variable.cs
- TimestampInformation.cs
- VirtualPathData.cs
- CodeExporter.cs
- SoapTypeAttribute.cs
- _CookieModule.cs
- ExceptionUtil.cs
- MemberAccessException.cs
- RoutedPropertyChangedEventArgs.cs
- DefaultSection.cs
- ContentHostHelper.cs
- ChameleonKey.cs
- BaseDataBoundControl.cs
- WebPartTransformerCollection.cs
- SafeNativeMethods.cs
- GridView.cs
- MetaChildrenColumn.cs
- FrameworkPropertyMetadata.cs
- Suspend.cs
- InkCanvasFeedbackAdorner.cs
- WebPartEditorApplyVerb.cs
- CompoundFileReference.cs
- UniformGrid.cs
- VirtualizedContainerService.cs
- CellConstantDomain.cs
- DummyDataSource.cs
- ConfigPathUtility.cs
- UserPreferenceChangedEventArgs.cs
- TrackingMemoryStreamFactory.cs
- ArgumentValidation.cs
- ImageAutomationPeer.cs
- DrawingCollection.cs