Exemple #1
0
        private static ScriptContainerControl GetHeaderEndScriptContainerControl(Page page)
        {
            ScriptContainerControl ctr = (ScriptContainerControl)page.Header.FindControl(_C_HEADER_END_SCRIPT_CONTROL_ID);

            if (ctr == null)
            {
                ctr    = new ScriptContainerControl();
                ctr.ID = _C_HEADER_END_SCRIPT_CONTROL_ID;
                page.Header.Controls.Add(ctr);
            }

            return(ctr);
        }
Exemple #2
0
        /// <summary>
        /// 在body结束前注册Script文件
        /// </summary>
        /// <param name="page">当前页面</param>
        /// <param name="scriptUrl">script文件url路径</param>
        /// <remarks>在body结束前注册Script</remarks>
        public static void RegisterBodyEndScript(Page page, string scriptUrl)
        {
            ScriptContainerControl ctr = GetScriptContainerControl(page);

            ctr.Add(scriptUrl, ScriptPositionMode.BodyEnd);
        }
        private static ScriptContainerControl GetHeaderEndScriptContainerControl(Page page)
        {
            ScriptContainerControl ctr = (ScriptContainerControl)page.Header.FindControl(_C_HEADER_END_SCRIPT_CONTROL_ID);
            if (ctr == null)
            {
                ctr = new ScriptContainerControl();
                ctr.ID = _C_HEADER_END_SCRIPT_CONTROL_ID;
                page.Header.Controls.Add(ctr);
            }

            return ctr;
        }