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
- FixedSOMContainer.cs
- UnsafeNativeMethods.cs
- ProgressBarHighlightConverter.cs
- ParameterBuilder.cs
- RepeaterItemEventArgs.cs
- SynchronizationHandlesCodeDomSerializer.cs
- OdbcConnectionOpen.cs
- SoapServerProtocol.cs
- Monitor.cs
- ProtocolsConfigurationHandler.cs
- TreeViewAutomationPeer.cs
- XMLSyntaxException.cs
- AuthenticatedStream.cs
- Vertex.cs
- ItemCheckEvent.cs
- PointLightBase.cs
- ProcessHostServerConfig.cs
- SchemaTableColumn.cs
- AnimationClockResource.cs
- AsyncResult.cs
- DataObjectPastingEventArgs.cs
- ManagementPath.cs
- AssertSection.cs
- ProfileService.cs
- RouteUrlExpressionBuilder.cs
- BufferedGraphics.cs
- CodeCompiler.cs
- RawUIStateInputReport.cs
- SR.cs
- XmlSchemaSimpleContent.cs
- TypeForwardedToAttribute.cs
- OleDbParameter.cs
- EpmSourceTree.cs
- BypassElement.cs
- ISAPIRuntime.cs
- BoundField.cs
- _Connection.cs
- RawKeyboardInputReport.cs
- WindowsAuthenticationModule.cs
- WebPartCollection.cs
- FixedSOMPageConstructor.cs
- OracleDateTime.cs
- TextureBrush.cs
- AuthenticationConfig.cs
- ConfigXmlText.cs
- ScrollViewer.cs
- RegistryPermission.cs
- NavigationProperty.cs
- MemberNameValidator.cs
- DataGridCellEditEndingEventArgs.cs
- precedingquery.cs
- RegexParser.cs
- TableLayoutSettings.cs
- TextProperties.cs
- FirewallWrapper.cs
- ObjectItemCollection.cs
- DataViewManager.cs
- FormsAuthenticationModule.cs
- UTF32Encoding.cs
- SqlInfoMessageEvent.cs
- InputMethodStateTypeInfo.cs
- PackagingUtilities.cs
- JsonDeserializer.cs
- SchemaNames.cs
- AncestorChangedEventArgs.cs
- CompositeActivityCodeGenerator.cs
- Part.cs
- CqlErrorHelper.cs
- ReferenceEqualityComparer.cs
- ConstraintManager.cs
- EncodingNLS.cs
- SoapDocumentMethodAttribute.cs
- UriExt.cs
- ReplyChannelAcceptor.cs
- ZipIOCentralDirectoryFileHeader.cs
- AssociationType.cs
- AnnotationResource.cs
- EastAsianLunisolarCalendar.cs
- nulltextnavigator.cs
- DbDataSourceEnumerator.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- FixedTextContainer.cs
- XPathBinder.cs
- HttpRuntime.cs
- ControlBuilder.cs
- SqlRecordBuffer.cs
- QuadraticBezierSegment.cs
- ListMarkerLine.cs
- AutomationPatternInfo.cs
- RefreshPropertiesAttribute.cs
- SimpleRecyclingCache.cs
- AtomMaterializer.cs
- MarkupCompilePass2.cs
- LayoutManager.cs
- ChtmlFormAdapter.cs
- Label.cs
- ReadOnlyAttribute.cs
- OracleBinary.cs
- OutOfMemoryException.cs
- UseAttributeSetsAction.cs