Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / Util / UnsettableComboBox.cs / 1 / UnsettableComboBox.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // UnsettableComboBox.cs // // 12/22/98: Created: [....] // namespace System.Web.UI.Design.Util { using System; using System.Design; using System.ComponentModel; using System.Windows.Forms; using System.Diagnostics; using System.Drawing; using System.Web.UI.Design; ////// /// Standard combobox with a "Not Set" item as the first item in its dropdown. /// It also automatically blanks out the "Not Set" item on losing focus. /// ///[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal sealed class UnsettableComboBox : ComboBox { private string notSetText; private bool internalChange; public UnsettableComboBox() { notSetText = SR.GetString(SR.UnsettableComboBox_NotSet); Items.Add(notSetText); } public string NotSetText { get { return notSetText; } set { notSetText = value; Items.RemoveAt(0); Items.Insert(0, notSetText); } } public override string Text { get { if ((this.SelectedIndex == 0) || (this.SelectedIndex == -1)) return String.Empty; else return base.Text; } set { base.Text = value; } } public void AddItem(object item) { Items.Add(item); } public void EnsureNotSetItem() { if (Items.Count == 0) { Items.Add(notSetText); } } public bool IsSet() { return SelectedIndex > 0; } protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (SelectedIndex == 0) { internalChange = true; SelectedIndex = -1; internalChange = false; } } protected override void OnSelectedIndexChanged(EventArgs e) { if (internalChange == false) { base.OnSelectedIndexChanged(e); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RegisteredArrayDeclaration.cs
- PeerNameResolver.cs
- LoginDesignerUtil.cs
- XmlHierarchicalDataSourceView.cs
- WorkflowServiceBuildProvider.cs
- SettingsPropertyValue.cs
- loginstatus.cs
- FormatPage.cs
- DefaultExpression.cs
- DataGridViewIntLinkedList.cs
- HtmlWindow.cs
- WsdlInspector.cs
- CqlBlock.cs
- AssemblyEvidenceFactory.cs
- ToolStripItemRenderEventArgs.cs
- LongSumAggregationOperator.cs
- UIntPtr.cs
- ProcessDesigner.cs
- RC2.cs
- HScrollBar.cs
- HttpMethodAttribute.cs
- StatusBarDrawItemEvent.cs
- DataComponentMethodGenerator.cs
- AnimationClockResource.cs
- MasterPageParser.cs
- XmlNullResolver.cs
- CompilerState.cs
- LogPolicy.cs
- DiagnosticSection.cs
- WindowsIPAddress.cs
- XmlToDatasetMap.cs
- SmiMetaData.cs
- RelatedImageListAttribute.cs
- ScrollBarAutomationPeer.cs
- ModelPerspective.cs
- UniqueIdentifierService.cs
- ToolStripAdornerWindowService.cs
- ClientBuildManagerCallback.cs
- RegexCompilationInfo.cs
- IsolatedStoragePermission.cs
- IisTraceWebEventProvider.cs
- Stylus.cs
- Lasso.cs
- InProcStateClientManager.cs
- ByteFacetDescriptionElement.cs
- TrustSection.cs
- HostedHttpRequestAsyncResult.cs
- PEFileReader.cs
- BoundingRectTracker.cs
- ExpressionStringBuilder.cs
- StringDictionaryCodeDomSerializer.cs
- CodeComment.cs
- LinkedResource.cs
- WebZone.cs
- LayoutUtils.cs
- BitmapEffectRenderDataResource.cs
- MobileControlDesigner.cs
- HtmlHistory.cs
- CheckBoxRenderer.cs
- ClockGroup.cs
- MultiPropertyDescriptorGridEntry.cs
- _NestedSingleAsyncResult.cs
- ImageFormatConverter.cs
- SerializationException.cs
- ContainerCodeDomSerializer.cs
- ListSourceHelper.cs
- SqlServer2KCompatibilityAnnotation.cs
- ShaderEffect.cs
- QilGeneratorEnv.cs
- BCLDebug.cs
- TimeIntervalCollection.cs
- RequestQueryParser.cs
- SharedPerformanceCounter.cs
- HyperlinkAutomationPeer.cs
- XPathNode.cs
- PointValueSerializer.cs
- SystemResources.cs
- FloaterParaClient.cs
- GeometryHitTestParameters.cs
- Collection.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ObjectParameter.cs
- ProtectedUri.cs
- DynamicILGenerator.cs
- configsystem.cs
- APCustomTypeDescriptor.cs
- ImageListStreamer.cs
- ToolStripContentPanel.cs
- DataBoundControlParameterTarget.cs
- SHA384Managed.cs
- DataReaderContainer.cs
- PolyQuadraticBezierSegment.cs
- SemanticResolver.cs
- WebPartDescriptionCollection.cs
- ListViewDeletedEventArgs.cs
- ExpressionHelper.cs
- MyContact.cs
- SmiEventSink_DeferedProcessing.cs
- LayoutTable.cs
- NativeMethods.cs