private static StyleSheetControl GetHeaderEndStyleSheetControl(Page page) { StyleSheetControl ctr = (StyleSheetControl)page.Header.FindControl(_C_HEADER_END_CSS_CONTROL_ID); if (ctr == null) { ctr = new StyleSheetControl(); ctr.ID = _C_HEADER_END_CSS_CONTROL_ID; page.Header.Controls.Add(ctr); } return(ctr); }
/// <summary> /// 在body结束前注册Css文件 /// </summary> /// <param name="page">当前页面</param> /// <param name="cssUrl">css文件url路径</param> /// <remarks>在body结束前注册Css</remarks> public static void RegisterBodyEndCss(Page page, string cssUrl) { StyleSheetControl ctr = GetStyleSheetControl(page); ctr.Add(cssUrl, StyleSheetPositionMode.BodyEnd); }
/// <summary> /// 在Head结束前注册Css文件 /// </summary> /// <param name="page">当前页面</param> /// <param name="cssUrl">css文件url路径</param> /// <remarks>在Head之间注册Css</remarks> public static void RegisterHeaderEndCss(Page page, string cssUrl) { StyleSheetControl ctr = GetHeaderEndStyleSheetControl(page); ctr.Add(cssUrl, StyleSheetPositionMode.Header); }