ScriptLink.RegisterCore Method
Registers the core.js file.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Parameters
- page
- Type: System.Web.UI.Page
The application page.
- defer
- Type: System.Boolean
Indicates whether to defer downloading the core.js file, that is, to fetch core.js asynchronously.
The following example shows how to build a new page layout which does not reference core.js, but downloads it while the page is being viewed, thereby optimizing response time. For more information, see the entry Building a New Page Layout… in the Microsoft Enterprise Content Management team blog.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.SharePoint; namespace WebControls { [DefaultProperty("Text")] [ToolboxData("<{0}:RegisterCoreWhenAuthenticatedControl runat=server></{0}:RegisterCoreWhenAuthenticatedControl>")] public class RegisterCoreWhenAuthenticatedControl : WebControl { protected override void OnInit(EventArgs e) { if (HttpContext.Current.Request.IsAuthenticated) { Microsoft.SharePoint.WebControls.ScriptLink.RegisterCore(this.Page, true); } base.OnInit(e); } } }