扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
using System; using System.ComponentModel; using System.Drawing; using System.Security.Permissions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebControlLibrary{ [ DefaultProperty("ButtonText"), ToolboxData("<{0}:Register runat=\"server\"> </{0}:Register>"), ] public class Register : CompositeControl { // 定义私有字段 private Button submitButton; private TextBox nameTextBox; private Label nameLabel; private TextBox emailTextBox; private Label emailLabel; private RequiredFieldValidator emailValidator; private RequiredFieldValidator nameValidator; // 实现属性ButtonText [ Bindable(true), Category("Appearance"), DefaultValue(""), Description("按钮上的文字内容.") ] public string ButtonText { get { EnsureChildControls(); return submitButton.Text; } set { EnsureChildControls(); submitButton.Text = value; } } // 实现属性Name [ Bindable(true), Category("Default"), DefaultValue(""), Description("用户名.") ] public string Name { get { EnsureChildControls(); return nameTextBox.Text; } set { EnsureChildControls(); nameTextBox.Text = value; } } // 实现属性NameErrorMessage [ Bindable(true), Category("Appearance"), DefaultValue(""), Description("用户名验证错误信息.") ] public string NameErrorMessage { get { EnsureChildControls(); return nameValidator.ErrorMessage; } set { EnsureChildControls(); nameValidator.ErrorMessage = value; nameValidator.ToolTip = value; } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。