public override System.Web.UI.Control CreateUIControl(HtmlGenericControl parent, object dataContext, AddressResx addressResx) { this.dataContext = dataContext; var tb = new System.Web.UI.WebControls.TextBox(); tb.ID = Name; tb.CssClass = Style; if (!string.IsNullOrEmpty(MaximumLength)) { tb.MaxLength = int.Parse(MaximumLength); } tb.TabIndex = short.Parse(IndexForTab); //tb.Text = ResolveBinding(dataContext); tb.EnableViewState = true; parent.Controls.Add(tb); if (!string.IsNullOrEmpty(ChangeHandler)) { tb.Attributes.Add("onChange", ChangeHandler); } if (!string.IsNullOrEmpty(KeyPressHandler)) { tb.Attributes.Add("onkeypress", KeyPressHandler); } if (!string.IsNullOrEmpty(KeyPressAndBlurHandler)) { tb.Attributes.Add("onkeypress", KeyPressAndBlurHandler); tb.Attributes.Add("onblur", KeyPressAndBlurHandler); } if (!string.IsNullOrEmpty(ReadOnly)) { tb.ReadOnly = ReadOnly.ToLower().Equals("true"); } if (!string.IsNullOrEmpty(HasFocus) && HasFocus.ToLower().Equals("true")) { tb.Focus(); } return(uiControl = tb); }