protected override void OnLoad(EventArgs e) { base.OnLoad(e); InitCategorys(CurrentCategory); IncludeJavaScript(); JavaScriptManager.Include("/Admin/Ajax/jquery/jquery.cookie.js", "/Admin/Ajax/jquery/jquery.treeview.min.js"); //HtmlGenericControl ctr = new HtmlGenericControl("link"); //ctr.Attributes["href"] = "/Admin/Ajax/jquery/css/jquery.treeview.css"; //ctr.Attributes["type"] = "text/css"; //ctr.Attributes["rel"] = "Stylesheet"; //Page.Header.Controls.Add(ctr); BindTree(); }
/// <summary> /// JS文件注册;可以引用多个文件,如: /// IncludeJavaScript("jquery.bgiframe.js", "jquery.dimensions.js", /// "jquery.jdMenu.js", "SlideMenuReady.js"); /// </summary> /// <param name="files"></param> public void IncludeJavaScript(params string[] files) { List <string> paths = new List <string>(); foreach (string file in files) { if (file.StartsWith("/")) { paths.Add(file); } else { paths.Add(TemplateSourceDirectory + "/js/" + file); } } JavaScriptManager.Include(paths.ToArray()); }
/// <summary> /// JS文件注册;可以引用多个文件,如: /// IncludeJavaScript("jquery.bgiframe.js", "jquery.dimensions.js", /// "jquery.jdMenu.js", "SlideMenuReady.js"); /// </summary> /// <param name="files"></param> public void IncludeJavaScript(params string[] files) { List <string> paths = new List <string>(); if (String.IsNullOrEmpty(Request["state"])) { paths.Add("/Scripts/jquery/jquery-1.4.2.js"); } foreach (string file in files) { if (file.StartsWith("/")) { paths.Add(file); } else { paths.Add(this.TemplateSourceDirectory + "/js/" + file); } } JavaScriptManager.Include(paths.ToArray()); }
/// <summary> /// 包含样式 /// </summary> /// <param name="includeJquery">是否包含Jquery</param> /// <param name="files"></param> protected void IncludeJavaScript(bool includeJquery, params string[] files) { List <string> paths = new List <string>(); if (includeJquery) { paths.Add("/Scripts/jquery/jquery-1.4.2.js"); } foreach (string file in files) { string f = file.Trim(); if (f.StartsWith("/")) { paths.Add(file); } else { paths.Add(this.TemplateSourceDirectory + "/js/" + f); } } JavaScriptManager.Include(paths.ToArray()); }