private static void ExcludeJavaScript(ClientScriptManager manager, string key)
 {
     var type = typeof(JavaScriptLibrary.JavaScriptHelper);
     var url = manager.GetWebResourceUrl(type, NAME_DUMMY_FILE);
     manager.RegisterStartupScript(type, key, string.Empty);
     manager.RegisterClientScriptInclude(type, key, url);
 }
示例#2
0
        /// <summary>
        /// 运行页面JS方法
        /// </summary>
        /// <param name="functionName">方法名 exp:  test(1)</param>
        /// <param name="page">页面类</param>
        public static void DoPageFunction(string functionName, Page page)
        {
            string openScript = "\n\t ";

            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#3
0
        /// <summary>
        /// 弹出提示并关闭fancybox
        /// </summary>
        /// <param name="Url">Url</param>
        /// <param name="page"></param>
        public static void AlertAndCloseJumpfancybox(string Url, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "parent.window.location.href ='" + Url + "';parent.$.fancybox.close(1);\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#4
0
        /// <summary>
        /// 对父窗体内的控件赋值  需回调控件CLICK
        /// </summary>
        /// <param name="ControlKey"></param>
        /// <param name="page"></param>
        public static void SetValueByParentControl(string ControlKey, string values, string CallBackid, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "parent.$(\"#" + ControlKey + "\").attr(\"value\",\"" + values + "\");\n\t parent.$(\"#" + CallBackid + "\").click();\n\t parent.$.fancybox.close(1);";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "SetValueByParentControl", openScript, true);
        }
示例#5
0
        public static void ClickParentControl(string ProcessResult, string CallBackid, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "alert('" + ProcessResult + "');\n\t parent.$(\"#" + CallBackid + "\").click();\n\t parent.$.fancybox.close(1);";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "SetValueByParentControl", openScript, true);
        }
示例#6
0
        /// <summary>
        /// 弹出提示并关闭fancybox
        /// </summary>
        /// <param name="ProcessResult">提示</param>
        /// <param name="page"></param>
        /// <param name="urlPar">url参数</param>
        public static void AlertAndClosefancybox(string ProcessResult, Page page, string urlPar)
        {
            string openScript = "\n\t ";

            openScript = openScript + "alert('" + ProcessResult + "');parent.$.fancybox.close(1);parent.window.location.href = parent.window.location.href" + urlPar + ";\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#7
0
        /// <summary>
        /// 弹出对话框
        /// </summary>
        /// <param name="ProcessResult">显示的提示文字</param>
        /// <param name="page">页面类</param>
        public static void AlertWindow(string ProcessResult, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "alert('" + ProcessResult + "');\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#8
0
        public static void AlertWindowAndGoLocationHref(string ProcessResult, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "alert('" + ProcessResult + "');\n\t";

            openScript = openScript + "  window.location.href = 'OngoingInvite.aspx?NeedPopu=1';\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertWindowAndGoLocationHref", openScript, true);
        }
示例#9
0
        /// <summary>
        /// 打开新窗口
        /// </summary>
        /// <param name="URI"></param>
        /// <param name="page"></param>
        public static void OpenWindown(string URI, Page page)
        {
            string openScript = string.Empty;

            //openScript = openScript + "alert('" + ProcessResult + "');\n\t";

            openScript = openScript + "  window.open('" + URI + "');\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "OpenWindown", openScript, true);
        }
示例#10
0
        /// <summary>
        /// 提示信息 并且跳转到指定页面
        /// </summary>
        /// <param name="ProcessResult"></param>
        /// <param name="URI"></param>
        /// <param name="page"></param>
        public static void AlertWindowAndLocation(string ProcessResult, string URI, Page page)
        {
            string openScript = "\n\t ";

            openScript = openScript + "alert('" + ProcessResult + "');\n\t";

            openScript = openScript + "  window.location.href = '" + URI + "';\n\t";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertWindowAndLocation", openScript, true);
        }
示例#11
0
        /// <summary>
        /// 弹出窗体
        /// </summary>
        /// <param name="PageUrl">窗体的地址</param>
        /// <param name="Title">显示的标题</param>
        /// <param name="Width">窗体的宽度</param>
        /// <param name="Height">窗体的高度</param>
        /// <param name="page">页面类</param>
        public static void PopUpWindowModalDialog(string PageUrl, string Title, int Width, int Height, Page page)
        {
            string openScript = "";

            openScript = openScript
                         + "\r\n "
                         + "window.showModalDialog('" + PageUrl + "','" + Title + "','dialogWidth:" + Width.ToString() + "px;dialogHeight:" + Height.ToString() + "px;Scroll=no;status=no')"
                         + "\r\n ";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#12
0
        /// <summary>
        /// 弹出窗体
        /// </summary>
        /// <param name="PageUrl">窗体的地址</param>
        /// <param name="Title">显示的标题</param>
        /// <param name="Width">窗体的宽度</param>
        /// <param name="Height">窗体的高度</param>
        /// <param name="page">页面类</param>
        public static void PopUpWindow(string PageUrl, string Title, int Width, int Height, Page page)
        {
            string openScript = "";

            openScript = openScript
                         + "\r\n "
                         + "window.open('" + PageUrl + "','" + Title + "','width=" + Width.ToString() + ",height=" + Height.ToString() + ",scrollbars=yes')"
                         + "\r\n ";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
示例#13
0
        /**/
        /// <summary>
        /// 主要实现进度条的功能,这段代码的调用就要实现进度的调度
        /// 实现主要过程
        /// default.aspx.cs是调用页面
        /// 放入page_load事件中
        ///            UIHelper myUI = new UIHelper();
        ///            Response.Write(myUI.ShowProgBar(this.Page,"../JS/progressbar.htm"));
        ///            Thread thread = new Thread(new ThreadStart(ThreadProc));
        ///            thread.Start();
        ///            LoadData();//load数据
        ///            thread.Join();
        ///            Response.Write("OK");
        ///
        /// 其中ThreadProc方法为
        ///     public void ThreadProc()
        ///    {
        ///    string strScript = "<script>setPgb('pgbMain','{0}');</script>";
        ///    for (int i = 0; i <= 100; i++)
        ///     {
        ///        System.Threading.Thread.Sleep(10);
        ///        Response.Write(string.Format(strScript, i));
        ///        Response.Flush();
        ///     }
        ///    }
        /// 其中LoadData()
        ///     public void LoadData()
        ///        {
        ///            for (int m = 0; m < 900; m++)
        ///            {
        ///                for (int i = 0; i < 900; i++)
        ///                {
        ///
        ///                }
        ///            }
        ///        }
        ///
        /// </summary>
        /// <param name="pageCurrent"></param>
        /// <param name="ShowProgbarScript"></param>
        /// <returns></returns>
        public static string ShowProgBar(System.Web.UI.Page pageCurrent, string ShowProgbarScript)
        {
            StreamReader  sr = new StreamReader(pageCurrent.MapPath(ShowProgbarScript), System.Text.Encoding.Default);
            StringBuilder sb = new StringBuilder();
            string        line;

            try
            {
                while ((line = sr.ReadLine()) != null)
                {
                    sb.AppendLine(line);
                }
                sr.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            //pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
            //            System.Guid.NewGuid().ToString(), sb.ToString());
            return(sb.ToString());
        }

        #endregion

        #region fixedHeader
        public static string fixedHeader()
        {
            StringBuilder s = new StringBuilder();

            s.Append(@"<table width='100%' border='1' cellspacing='0' style='MARGIN-TOP:-2px'>");
            s.Append(@"<TR class='fixedHeaderTr' style='BACKGROUND:navy;COLOR:white'>");
            s.Append(@"<TD nowrap>Header A</TD>");
            s.Append(@"<TD nowrap>Header B</TD>");
            s.Append(@"<TD nowrap>Header C</TD>");
            s.Append(@"</TR>");
            for (int m = 0; m < 100; m++)
            {
                s.Append(@"<TR>");
                s.Append(@"<TD>A").Append(m).Append("</TD>");
                s.Append(@"<TD>B").Append(m).Append("</TD>");
                s.Append(@"<TD>C").Append(m).Append("</TD>");
                s.Append(@"</TR>");
            }
            s.Append(@"</table>");
            return(s.ToString());
        }

        #endregion

        #region refreshPage
        public static void refreshPage(System.Web.UI.Page pageCurrent)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<script language=\"javascript\">");
            sb.Append("window.location.reload(true);");
            sb.Append("</script>");
            pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
                                                           System.Guid.NewGuid().ToString(), sb.ToString());
        }

        #endregion

        #region Page_revealTrans
        //进入页面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
        //推出页面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">
        //这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23:
        //  0 矩形缩小
        //  1 矩形扩大
        //  2 圆形缩小
        //  3 圆形扩大
        //  4 下到上刷新
        //  5 上到下刷新
        //  6 左到右刷新
        //  7 右到左刷新
        //  8 竖百叶窗
        //  9 横百叶窗
        //  10 错位横百叶窗
        //  11 错位竖百叶窗
        //  12 点扩散
        //  13 左右到中间刷新
        //  14 中间到左右刷新
        //  15 中间到上下
        //  16 上下到中间
        //  17 右下到左上
        //  18 右上到左下
        //  19 左上到右下
        //  20 左下到右上
        //  21 横条
        //  22 竖条
        //  23 以上22种随机选择一种

        public static string Page_revealTrans(System.Web.UI.Page currentPage, string duration,
                                              string transition)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<meta http-equiv=\"Page-Enter\"");
            sb.Append("content=\"");
            sb.Append("revealTrans(duration=" + duration);
            sb.Append(",transition=" + transition);
            sb.Append(")\">");
            //currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(),
            //        System.Guid.NewGuid().ToString(), sb.ToString());
            return(sb.ToString());
        }

        #endregion

        /// <summary>
        /// 显示一段自定义的输出代码
        /// </summary>
        /// <param name="page">页面指针,一般为This</param>
        public static void RegisterStartupScript(System.Web.UI.Page page, string script)
        {
            var sb = new StringBuilder();

            sb.Append("<script type=\"text/javascript\"> ");
            sb.Append(script.Trim());
            sb.Append("</script>");
            page.ClientScript.RegisterStartupScript(page.GetType(), page.GetType().Name, sb.ToString());
        }

        public static void RegisterClientScriptBlock(System.Web.UI.Page page, string script)
        {
            var sb = new StringBuilder();

            sb.Append("<script type=\"text/javascript\"> ");
            sb.Append(script.Trim());
            sb.Append("</script>");
            page.ClientScript.RegisterClientScriptBlock(page.GetType(), page.GetType().Name, sb.ToString());
        }

        /**/
        /// <summary>
        /// 调用客户端JavaScript函数
        /// </summary>
        /// <param name="page">页面指针,一般为This</param>
        /// <param name="scriptName">函数名,带参数,如:FunA(1);</param>
        public static void CallClientScript(System.Web.UI.Page page, string scriptName)
        {
            String csname = "PopupScript";
            Type   cstype = page.GetType();

            System.Web.UI.ClientScriptManager cs = page.ClientScript;
            if (!cs.IsStartupScriptRegistered(cstype, csname))
            {
                String cstext = scriptName;
                cs.RegisterStartupScript(cstype, csname, cstext, true);
            }
        }
示例#14
0
        /// <summary>
        /// 弹出对话框,然后关闭当前窗口
        /// </summary>
        /// <param name="ProcessResult">显示的提示文字</param>
        /// <param name="page">页面类</param>
        public static void CloseWindow(string ProcessResult, Page page)
        {
            string openScript = "";

            openScript = openScript
                         + "\r\n "
                         + "alert('" + ProcessResult + "');\r\n"
                         + "window.close();window.opener.location.reload();\r\n";

            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "WindowCloseWindow", openScript, true);
        }
示例#15
0
        /// <summary>
        /// 重载弹出对话框
        /// </summary>
        /// <param name="ProcessResult">显示的提示文字</param>
        /// <param name="cReturnUrl">返回地址</param>
        /// <param name="page">页面类</param>
        public static void ConfirmWindow(string ProcessResult, string cReturnUrl, Page page)
        {
            string openScript = "";

            openScript = openScript
                         + "\r\n "
                         + "if(confirm('" + ProcessResult + "')){"
                         + "\r\n "
                         + "location.href('" + cReturnUrl + "')};"
                         + "\r\n ";
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "AlertAndClosefancybox", openScript, true);
        }
 private static void IncludeJavaScript(ClientScriptManager manager, string resourceName, bool late)
 {
     var type = typeof(JavaScriptLibrary.JavaScriptHelper);
     
     if (!manager.IsStartupScriptRegistered(type, resourceName)) 
     {
         if (late)
         {
             var url = manager.GetWebResourceUrl(type, resourceName);
             var scriptBlock = string.Format(TEMPLATE_SCRIPT, HttpUtility.HtmlEncode(url));
             manager.RegisterStartupScript(type, resourceName, scriptBlock);
         }
         else
         {
             manager.RegisterClientScriptResource(type, resourceName);
             manager.RegisterStartupScript(type, resourceName, string.Empty);
         }
     }
     
     //manager.RegisterClientScriptResource(type, resourceName);
 }
示例#17
0
        private static void AddHtmlValidationScript(ClientScriptManager scriptManager)
        {
            scriptManager.RegisterStartupScript(typeof(ValidatorUtil), "ValidatorUtil.AddHtml5Validation",
            @"; var ValidatorUtil_AddHtml5Validation = function(clientId) {
            var ctrl = document.getElementById(clientId);
            if (!ctrl) {
            console.warn('Unable to find element with id ' + clientId + ', ignoring html5 validation for this validator.');
            return;
            }

            var prev = ctrl.evaluationfunction;
            if (typeof(prev) == 'string') {
            ctrl.evaluationfunction = eval(ctrl.evaluationfunction);
            prev = ctrl.evaluationfunction;
            }

            ctrl.evaluationfunction = function(val) {
            var result = prev(val);
            if (result) {
            var prevIsValid = true;
            for (i = 0; i < Page_Validators.length; i++) {
                var previousValidator = Page_Validators[i];
                if (previousValidator != val && previousValidator.controltovalidate == val.controltovalidate) {
                    prevIsValid = prevIsValid && previousValidator.isvalid;
                }
            }

            if (prevIsValid) {
                var input = document.getElementById(val.controltovalidate);
                if (input && input.setCustomValidity) {
                    input.setCustomValidity('');
                }

                if (jQuery) {
                    var field = jQuery(val).parent('.field');
                    field.removeClass('invalid');
                }
            }
            } else {
            var input = document.getElementById(val.controltovalidate);
            if (input && input.setCustomValidity) {
                input.setCustomValidity(val.errormessage);
            }

            if (jQuery) {
                var field = jQuery(val).parent('.field');
                field.addClass('invalid');
            }
            }

            return result;
            };
            };", true);
        }
示例#18
0
 public static void Message(Type t,ClientScriptManager cs,string msg)
 {
     cs.RegisterStartupScript(t,"��ʾ", string.Format("<script>alert('{0}')</script>",msg));
 }
示例#19
0
        }        /// <summary>

        /// <summary>
        /// 向页面输出指定的JS代码
        /// </summary>
        /// <param name="Script"></param>
        public static void ResponseScript(string Script, Page page)
        {
            System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
            OjbClientScript.RegisterStartupScript(page.GetType(), "ResponseScript", Script, true);
        }
示例#20
0
 public static void RegisterClientScript(Type t, string key, ClientScriptManager cs, string script)
 {
     cs.RegisterStartupScript(t, key, script);
 }
示例#21
0
 /// <summary>
 /// 运行脚本
 /// </summary>
 /// <param name="script"></param>
 /// <param name="key"></param>
 public void RegScript(string script, string key)
 {
     System.Web.UI.ClientScriptManager cs = Page.ClientScript;
     cs.RegisterStartupScript(this.Page.GetType(), key, script, true);
 }
示例#22
0
 /// <summary>
 /// 注册JS代码,并运行
 /// </summary>
 /// <param name="jsString"></param>
 /// <param name="page"></param>
 public static void RegisterJsCodeSource(string jsString, Page page)
 {
     System.Web.UI.ClientScriptManager OjbClientScript = page.ClientScript;
     OjbClientScript.RegisterStartupScript(page.GetType(), "RegisterJsCodeSource", jsString, true);
 }
示例#23
0
文件: PubClass.cs 项目: kexinn/Edu
 public static void showAlertMessage(Page p, ClientScriptManager ClientScript, string message)
 {
     ClientScript.RegisterStartupScript(p.GetType(),"", "<script>alert('"+message+"');<" + "/script>");
 }
示例#24
0
        /// <summary>
        /// 将此控件呈现给指定的输出参数。
        /// </summary>
        /// <param name="output"> 要写出到的 HTML 编写器 </param>
        protected override void Render(HtmlTextWriter output)
        {
            if (this.BackColorFocus != "")
            {
                base.Attributes.Add("onfocus", "this.style.background='" + this.BackColorFocus + "'");
                //if(!HasDropDownList)
                base.Attributes.Add("onblur", "this.style.background='#ffffff'");
                //else
                //	base.Attributes.Add("onblur", "this.style.background='#ffffff';if(!document.getElementById('" + this.ClientID + "List').focused){document.getElementById('" + this.ClientID + "List').style.display='none';}");
            }
            //if (this.CssFocus != "")
            //{
            //    base.Attributes.Add("onmousedown", "this.className='" + this.CssFocus + "'");
            //    base.Attributes.Add("onmouseout", "this.className='" + this.CssClass + "'");
            //}
            if (this.HasDropDownList)
            {
                base.Attributes.Add("title", "点击显示下拉框");
                base.Attributes.Add("onclick", "ShowList('" + this.ClientID + "');");
            }
            //输出
            base.Render(output);
            output.Write("&nbsp;");

            if (InputExplain.Trim() != "")
            {
                this.lblExplain.ID = "lbl" + base.ID;
                this.lblExplain.RenderControl(output);
            }

            if (!this.AllowEmpty)
            {
                this.rfvDataInput.ID = "rfv" + base.ID;
                this.rfvDataInput.ControlToValidate = base.ID;
                this.rfvDataInput.RenderControl(output);
            }

            if (this.ValidType != DataType.Never && this.ValidType != DataType.String)
            {
                this.revDataInput.ID = "rev" + base.ID;
                this.revDataInput.ControlToValidate    = base.ID;
                this.revDataInput.ValidationExpression = this.GetValidRegex();
                this.revDataInput.ErrorMessage         = error;
                this.revDataInput.RenderControl(output);
            }

            //可调整高度
            if (this.IsRegulateHeight)
            {
                #region
                StringBuilder sbscript = new StringBuilder();
                sbscript.Append("\n<!--调节输入框高度 begin-->\n");
                sbscript.Append("	<script type=\"text/javascript\">\n");
                sbscript.Append("		//Plus\n");
                sbscript.Append("		function PlusHeight(id)\n");
                sbscript.Append("		{\n");
                sbscript.Append("			var txtInput = document.getElementById(id);\n");
                sbscript.Append("				txtInput.rows = parseInt(txtInput.rows) + "+ this.RegulateRows + ";\n");
                //sbscript.Append("			txtInput.style.height = txtInput.style.height+15;\n");
                sbscript.Append("		}\n");
                sbscript.Append("		//Minus\n");
                sbscript.Append("		function MinusHeight(id)\n");
                sbscript.Append("		{\n");
                sbscript.Append("			var txtInput = document.getElementById(id);\n");
                sbscript.Append("			if( parseInt(txtInput.rows) >= "+ (this.RegulateRows + 1) + " )\n");
                sbscript.Append("				txtInput.rows = parseInt(txtInput.rows) - "+ this.RegulateRows + ";\n");
                sbscript.Append("		}\n");
                sbscript.Append("	</script>\n");
                sbscript.Append("<!--调节输入框高度 end-->\n");

                System.Web.UI.ClientScriptManager client = this.Page.ClientScript;
                Type cstype = Page.GetType();
                if (!client.IsStartupScriptRegistered(cstype, "regulateheight"))
                {
                    client.RegisterStartupScript(cstype, "regulateheight", sbscript.ToString());
                }

                StringBuilder sbhtml = new StringBuilder();
                sbhtml.Append("<div style=\"height:24px;\">");
                sbhtml.Append("	" + this.ImageIconMinus + "&nbsp;&nbsp;" + this.ImageIconPlus);
                sbhtml.Append("</div>");
                output.Write(sbhtml.ToString());
                #endregion
            }
            //下拉框模式
            if (this.HasDropDownList)
            {
                #region
                //已经改为点击输入框的时候激发客户端事件
                //output.Write("<img id=\"" + this.ClientID + "Icon\" src=\"" + this.ImageIconShowDropDown + "\" border=\"0\" style=\"cursor:hand;\" onclick=\"ShowList('" + this.ClientID + "');\" align=\"absmiddle\" />\n");
                int width = Convert.ToInt32(base.Width.Value);
                width = width == 0 ? 100 : width;
                output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "display:none;position:absolute;");
                output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Id, this.ClientID + "List");
                output.RenderBeginTag(HtmlTextWriterTag.Div);
                output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "margin-left:" + width + "px;");
                output.RenderBeginTag(HtmlTextWriterTag.Span);

                drpList.ID = base.ID + "Items";
                drpList.Style.Add("margin-left", "-" + width + "px");
                drpList.Attributes.Add("onchange", "document.getElementById('" + this.ClientID + "').value=this.options[this.selectedIndex].text;document.getElementById('" + this.ClientID + "List').style.display='none';");
                //drpList.Attributes.Add("onblur", "this.style.display='none'");
                if (this.DropDownListDataSource != null && this.DropDownListDataSource.Rows.Count > 0)
                {
                    drpList.DataTextField  = this.DataTextField;
                    drpList.DataValueField = this.DataValueField;
                    drpList.DataSource     = this.DropDownListDataSource.DefaultView;
                    drpList.DataBind();
                }
                if (HasDefaultItem)
                {
                    drpList.Items.Insert(0, new ListItem(this.DefaultItemText, this.DefaultItemValue));
                }
                foreach (ListItem item in drpList.Items)
                {
                    if (item.Text == base.Text.Trim())
                    {
                        item.Selected = true;
                        break;
                    }
                }
                this.drpList.RenderControl(output);
                output.RenderEndTag();
                output.RenderEndTag();

                StringBuilder sbscript = new StringBuilder();
                #region js内容
                sbscript.Append("\n<script type=\"text/javascript\">\n");
                sbscript.Append("	<!--下拉框显示隐藏 begin-->\n");
                sbscript.Append("	function ShowList(id)\n");
                sbscript.Append("	{\n");
                sbscript.Append("		var txtInput = document.getElementById(id);\n");
                sbscript.Append("		var drpList = document.getElementById(id+'List');\n");
                //sbscript.Append("		var drpIcon = document.getElementById(id+'Icon');\n");
                sbscript.Append("		var drpItems = document.getElementById(id+'Items');\n");                //下拉框
                sbscript.Append("		if(drpList.style.display == 'block')\n");
                sbscript.Append("		{\n");
                sbscript.Append("			txtInput.title = '点击显示下拉框';\n");
                sbscript.Append("			drpList.style.display = 'none';\n");
                //sbscript.Append("			drpIcon.src = '" + this.ImageIconShowDropDown + "';\n");
                sbscript.Append("		}\n");
                sbscript.Append("		else\n");
                sbscript.Append("		{\n");
                sbscript.Append("			txtInput.title = '点击关闭下拉框';\n");
                sbscript.Append("			drpList.style.display = 'block';\n");
                sbscript.Append("			drpList.style.left = GetOffsetLeft(txtInput)+'px';\n");
                sbscript.Append("			drpList.style.top = (GetOffsetTop(txtInput)+1)+'px';\n");
                sbscript.Append("			drpItems.style.width = txtInput.offsetWidth+'px';\n");
                //sbscript.Append("			drpIcon.src = '" + this.ImageIconHideDropDown + "';\n");
                sbscript.Append("		}\n");
                sbscript.Append("	}\n");
                sbscript.Append("	<!--下拉框显示隐藏 end-->\n");
                sbscript.Append("	function GetOffsetTop(e) \n");
                sbscript.Append("	{\n");
                sbscript.Append("		var offsetTop = e.offsetTop;\n");
                sbscript.Append("		var offsetParent = e.offsetParent;\n");
                sbscript.Append("		while(offsetParent)\n");
                sbscript.Append("		{\n");
                sbscript.Append("			offsetTop += offsetParent.offsetTop;\n");
                sbscript.Append("			offsetParent = offsetParent.offsetParent;\n");
                sbscript.Append("		}\n");
                sbscript.Append("		return offsetTop+e.offsetHeight;\n");
                sbscript.Append("	}\n");
                sbscript.Append("	function GetOffsetLeft(e) \n");
                sbscript.Append("	{\n");
                sbscript.Append("		var offsetLeft = e.offsetLeft;\n");
                sbscript.Append("		var offsetParent = e.offsetParent;\n");
                sbscript.Append("		while(offsetParent) \n");
                sbscript.Append("		{\n");
                sbscript.Append("			offsetLeft += offsetParent.offsetLeft;\n");
                sbscript.Append("			offsetParent = offsetParent.offsetParent;\n");
                sbscript.Append("		}\n");
                sbscript.Append("		return offsetLeft;\n");
                sbscript.Append("	}\n");
                sbscript.Append("</script>\n");
                # endregion
                System.Web.UI.ClientScriptManager client = this.Page.ClientScript;
                Type cstype = Page.GetType();
                if (!client.IsStartupScriptRegistered(cstype, "showlist"))
                {
                    client.RegisterStartupScript(cstype, "showlist", sbscript.ToString());
                }

                #endregion
            }