[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 authored at 2024-08-09 00:30:41 石头 committed at 2024-08-10 14:22:24
1.38 KiB
X
using System;
using System.ComponentModel;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace XControl
{
    /// <summary>邮件地址输入控件。只能输入数字,并可以规定范围、间隔。</summary>
    [Description("邮件地址输入控件")]
    [ToolboxData("<{0}:MailBox runat=server></{0}:MailBox>")]
    [ToolboxBitmap(typeof(TextBox))]
    public class MailBox : TextBox
    {
        /// <summary>初始化邮件地址输入控件的样式。</summary>
        public MailBox()
            : base()
        {
            this.ToolTip = "只能输入邮件地址!";
            BorderWidth = Unit.Pixel(0);
            BorderColor = Color.Black;
            BorderStyle = BorderStyle.Solid;
            Font.Size = FontUnit.Point(10);
            Width = Unit.Pixel(120);
            if (String.IsNullOrEmpty(Attributes["style"])) this.Attributes.Add("style", "border-bottom-width:1px;");
        }

        /// <summary>已重载。</summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            // 校验脚本
            this.Attributes.Add("onblur", "return ValidMail();");
            this.Page.ClientScript.RegisterClientScriptResource(typeof(NumberBox), "XControl.TextBox.Validator.js");
        }
    }
}