protected override void CreateChildControls() { base.CreateChildControls(); _stateDropdownList = new HBDropDownList { ID = "stateDropdownList" }; _areaInputBox = new TextBox { ID = "areaInputBox" }; _mainInputBox = new TextBox { ID = "mainInputBox" }; _extInputBox = new TextBox { ID = "extInputBox" }; if (PhoneNumberCategory == PhoneNumberCategory.Cellphone) { (((int)this.PhoneNumberUseMode & AREANUMBER_FLAG) > 0 || ((int)this.PhoneNumberUseMode & EXTNUMBER_FLAG) > 0).TrueThrow("PhoneNumberCategory为手机时,PhoneNumberUseMode不可包含区号和分机。"); } if (!this.ReadOnly) { if (((int)this.PhoneNumberUseMode & STATENUMBER_FLAG) > 0) { var lineSpan = new HtmlGenericControl() { TagName = "span", InnerText = "—" }; Controls.Add(this._stateDropdownList); Controls.Add(lineSpan); BindListControl(); } if (((int)this.PhoneNumberUseMode & AREANUMBER_FLAG) > 0) { var lineSpan = new HtmlGenericControl() { TagName = "span", InnerText = "—" }; Controls.Add(this._areaInputBox); Controls.Add(lineSpan); } if (((int)this.PhoneNumberUseMode & PHONENUMBER_FLAG) > 0) { Controls.Add(this._mainInputBox); if (((int)this.PhoneNumberUseMode & EXTNUMBER_FLAG) > 0) { var lineSpan = new HtmlGenericControl() { TagName = "span", InnerText = "—" }; Controls.Add(lineSpan); } } if (((int)this.PhoneNumberUseMode & EXTNUMBER_FLAG) > 0) { Controls.Add(this._extInputBox); } //如果没有添加Validator则添加Validator if (this.Visible && this.Page.Items.Contains("telephoneClientValidate") == false && !RenderMode.OnlyRenderSelf) { this.Controls.Add(this.submitValidator); this.Page.Items.Add("telephoneClientValidate", "exist"); } } }