Example #1
0
        protected override void OnPreRender(EventArgs e)
        {
            this.Page.ClientScript.RegisterClientScriptInclude("webcontrolsscript",
                                                               Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControls.JS.WebControlsScript.js"));
            this.Page.ClientScript.RegisterClientScriptInclude("webvalidatscript",
                                                               Page.ClientScript.GetWebResourceUrl(this.GetType(), "WebControls.JS.jqueryvalidat.js"));

            string script = string.Empty;

            if (!string.IsNullOrEmpty(RegularExpressionString))
            {
                script += string.Format("$(document).ready(function(){{AddToVerifyArray($(\"#{0}\"),'{1}');}});\n",
                                        this.ClientID, this.RegularExpressionString);
            }

            if (!IsAllowNull)
            {
                script += string.Format("$(document).ready(function(){{AddToCheckNullArray($(\"#{0}\"));}});\n",
                                        this.ClientID);
            }

            if (IsReadOnly)
            {
                script += string.Format("$(document).ready(function(){{AddToDisabledArray($(\"#{0}\"));}});\n", this.ClientID);
            }

            if (!string.IsNullOrEmpty(script))
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "startup" + this.ClientID, script, true);
            }

            //this.Attributes.Add("onmouseover", "showhintinfo(this, 0,0,'测试','email格式错误','20','up')");
            //this.Attributes.Add("onmouseout", "hidehintinfo()");
            if (RequiredType != DataType.Empty)
            {
                if (this.Attributes["onblur"] != null)
                {
                    this.Attributes.Add("onblur", string.Format("ValidatData('{0}','{1}',{2},{3},'{4}','{5}','{6}','{7}',{8});{9}", this.ClientID
                                                                , RequiredType.ToString().ToLower(), HintLeftOffSet, HintTopOffSet, HintTitle, HintInfo, HintHeight, HintShowType.ToString(), HintTimeOut, this.Attributes["onblur"]));
                }
                else
                {
                    this.Attributes.Add("onblur", string.Format("ValidatData('{0}','{1}',{2},{3},'{4}','{5}','{6}','{7}',{8});", this.ClientID
                                                                , RequiredType.ToString().ToLower(), HintLeftOffSet, HintTopOffSet, HintTitle, HintInfo, HintHeight, HintShowType.ToString(), HintTimeOut));
                }
            }

            //this.Page.ClientScript.RegisterOnSubmitStatement(this.Page.GetType(), "checkonsubmit", "return  CheckAll()");

            base.OnPreRender(e);
        }
Example #2
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append(string.Format("RequiredType = {0},DataType = {1},DataName = {2},Name = {3},FieldNumber = {4},", RequiredType.ToString(), DataType.ToString(), DataName, Name, FieldNumber));

            sb.Append("Summarys:[");

            for (int i = 0; i < Summarys.Count; i++)
            {
                if (i == Summarys.Count - 1)
                {
                    sb.Append(Summarys[i]);
                }
                else
                {
                    sb.Append(Summarys[i]).Append(",");
                }
            }
            sb.Append("]");
            sb.Append("}");
            return(sb.ToString());
        }