Source Codes of ComboBox (WebForm)

xiaoxiao2021-04-02  220

using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Lostinet.Sample {[DefaultEvent ( "TextChanged"), DefaultProperty ( "Text"),] public class ComboBox: WebControl, INamingContainer, IPostBackDataHandler {ListBox lb; public ComboBox (): base (HtmlTextWriterTag.Input) {lb = new ListBox (); lb .Style ["position"] = "absolute"; lb.style ["display"] = "none"; lb.style ["filter"] = "progid: DxImageTransform.microsoft.dropshadow (off = 2, offy = 2 , Color = 'gray', Positive = 'true') "; lb.EnableViewState = false; Controls.Add (lb);} ListItemCollection _coll = new ListItemCollection (); [PersistenceMode (PersistenceMode.InnerProperty), DesignerSerializationVisibility (DesignerSerializationVisibility.Content ) ,] Public ListItemCollection Items {get {return _coll;}} [DefaultValue (false),] public bool AutoPostBack {get {return ViewState [ "AutoPostBack"] == null false:? True;} set {if (value) ViewState [ "Autopostback"] = 0; Else ViewState.remove ("autopostback");}} [defaultValue (""),] public string text {get {return configuration ("means [" text "]);} set {viewState ["Text"] = value;

}} [DefaultValue (0),] public int maxngth {get {object o = viewState ["maxlength"]; return o == null? 0: (int) O;} set {viewstate ["maxlength"] = Value; }} static private string _scriptBlock; static protected string ScriptBlock {get {if (_scriptBlock == null) {using (Stream s = typeof (ComboBox) .Assembly.GetManifestResourceStream (typeof (ComboBox) .FullName ". js")) {using (StreamReader sr = new StreamReader (s)) {_scriptBlock = "