SharePoint【学习笔记】-- Sharepoint JS CSS 注册

前台注册

适用于2010VisualWebpart,应用程序页

<SharePoint:ScriptLink Language="javascript" ID="jqueryScriptLink" Name="/_layouts/tgUI/jquery-1.6.4.js" Defer="false" runat="server"/>   
<SharePoint:CssRegistration  ID="SDCSSLink"  Name="/_layouts/tgUI/pagestyle.css" runat="server"/>

 

后台注册

适用于2007、2010Webpart,在CreateChildControls中添加

ScriptLink.Register(this.Page, "tgUI/jquery-1.6.4.js", false);

推荐上面这种方式,避免重复注册;且能生成缓存安全 URL,提示找不到该文件

image
ScriptLink JqueryJSLink;   
JqueryJSLink = new ScriptLink();   
JqueryJSLink.ID = "JqueryJSLink";   
JqueryJSLink.Language = "javascript";   
JqueryJSLink.Name = "/_layouts/tgUI/jquery-1.6.4.js";   
this.Controls.Add(JqueryJSLink);


CssRegistration jstreeCSSLink;   
jstreeCSSLink = new CssRegistration();   
jstreeCSSLink.ID = "jstreeCSSLink";   
jstreeCSSLink.Name = "/_layouts/tgUI/jstree/themes/default/style.css";   
this.Controls.Add(jstreeCSSLink);

 

 

你可能感兴趣的:(SharePoint)