Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / DropDownList.cs / 2 / 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) { // VSWhidbey 204824 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")); } } }Raises events for the ///control on post back.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartManagerInternals.cs
- MulticastOption.cs
- ImpersonationContext.cs
- MetadataPropertyAttribute.cs
- MILUtilities.cs
- SafeSecurityHandles.cs
- GeneralTransformGroup.cs
- SamlAttribute.cs
- __Filters.cs
- BitmapFrameDecode.cs
- LinkGrep.cs
- StackBuilderSink.cs
- WindowHideOrCloseTracker.cs
- LiteralLink.cs
- TextDataBindingHandler.cs
- AdapterUtil.cs
- InfiniteIntConverter.cs
- StringComparer.cs
- TreeNode.cs
- HttpException.cs
- HtmlTable.cs
- DeferredElementTreeState.cs
- SoapElementAttribute.cs
- ResourcePermissionBaseEntry.cs
- WebColorConverter.cs
- DataGridItemAutomationPeer.cs
- DataGridColumnCollection.cs
- EtwTrace.cs
- RouteItem.cs
- smtpconnection.cs
- HyperLinkStyle.cs
- TextRangeProviderWrapper.cs
- AudioStateChangedEventArgs.cs
- StrongNamePublicKeyBlob.cs
- DataGridParentRows.cs
- NativeMethodsCLR.cs
- TypeDescriptor.cs
- ReflectionUtil.cs
- TreeNodeBinding.cs
- ColorEditor.cs
- ReachVisualSerializerAsync.cs
- AssertFilter.cs
- DataServiceProcessingPipelineEventArgs.cs
- ToolStripDropDownClosedEventArgs.cs
- Transform3DGroup.cs
- GlyphingCache.cs
- CurrencyWrapper.cs
- UpdatePanel.cs
- TextEditorSpelling.cs
- XslAst.cs
- ContentPlaceHolder.cs
- XmlDataSourceView.cs
- DateTimeUtil.cs
- RuleConditionDialog.cs
- EncoderReplacementFallback.cs
- EpmSourceTree.cs
- InProcStateClientManager.cs
- WebEventCodes.cs
- DispatcherHookEventArgs.cs
- InertiaRotationBehavior.cs
- WindowsStartMenu.cs
- SettingsAttributeDictionary.cs
- bindurihelper.cs
- FormatterServices.cs
- Label.cs
- WhitespaceSignificantCollectionAttribute.cs
- TableParagraph.cs
- PerspectiveCamera.cs
- CustomErrorsSection.cs
- BooleanExpr.cs
- DataGridColumnEventArgs.cs
- XmlMemberMapping.cs
- AlgoModule.cs
- MSAANativeProvider.cs
- InputScopeAttribute.cs
- RelatedPropertyManager.cs
- ApplicationInfo.cs
- NominalTypeEliminator.cs
- ExtenderProviderService.cs
- IApplicationTrustManager.cs
- CatalogPart.cs
- ExtendedPropertiesHandler.cs
- WebServiceEnumData.cs
- IncrementalHitTester.cs
- SafeArrayTypeMismatchException.cs
- SkinIDTypeConverter.cs
- WebPartEditorCancelVerb.cs
- StreamUpdate.cs
- AuthenticationService.cs
- MessagePropertyDescriptionCollection.cs
- StringAnimationUsingKeyFrames.cs
- TextAnchor.cs
- SynchronizedInputHelper.cs
- NamedObject.cs
- AspNetHostingPermission.cs
- SqlStream.cs
- ControlAdapter.cs
- PropertyStore.cs
- JobStaple.cs
- ControlUtil.cs