This is a proxy object for the Page.ClientScript and MS Ajax ScriptManager object that can operate when MS Ajax when present otherwise falling back to Page.ClientScript. Because MS Ajax may not be available accessing the methods directly is not possible and we are required to indirectly reference client script methods through this class.
This class should be invoked at the Control's start up and be used to replace all calls Page.ClientScript. Scriptmanager calls are made through Reflection indirectly so there's no dependency on the script manager.
This class also provides a few additional page injection helpers like the abillity to load scripts in the page header (rather than in the body) and to use script compression using wwScriptCompressionModule without using MS Ajax.
Westwind.Web.ClientScriptProxy
public class ClientScriptProxy : object
Class Members
Member | Description | |
---|---|---|
DefaultScriptRenderMode |
Determines the default script rendering mode that is uses if no script rendering mode is explicitly provided on the control. | |
ScriptResourceAliases |
||
ClearContextItemsOnTransfer |
Clears all the request specific context items which are script references and the script placement index. public void ClearContextItemsOnTransfer() |
|
GetClientScriptResourceUrl |
Works like GetWebResourceUrl but can be used with javascript resources to allow using of resource compression (if the Script Compression Module is loaded). public string GetClientScriptResourceUrl(Control control, Type type, string resourceName) public string GetClientScriptResourceUrl(Type type, string resourceName) |
|
GetWebResourceUrl |
Returns a WebResource URL for non script resources public string GetWebResourceUrl(Control control, Type type, string resourceName) public string GetWebResourceUrl(Type type, string resourceName) |
|
IsMsAjax |
Checks to see if MS Ajax is registered with the current Web application. public static bool IsMsAjax() |
|
IsScriptManagerOnPage |
Checks to see if a script manager is on the page public bool IsScriptManagerOnPage(Page page) |
|
LoadControlScript |
High level helper function that is used to load script resources for various AJAX controls Loads a script resource based on the following scriptLocation values: public void LoadControlScript(Control control, string scriptLocation, string resourceName, ScriptRenderModes renderMode) public void LoadControlScript(Control control, string scriptLocation, string resourceName) public void LoadControlScript(Control control, string scriptLocation) |
|
RegisterClientScriptBlock |
Registers a client script block in the page. public void RegisterClientScriptBlock(Control control, Type type, string key, string script, bool addScriptTags) public void RegisterClientScriptBlock(Control control, Type type, string key, string script, bool addScriptTags, ScriptRenderModes renderMode) |
|
RegisterClientScriptInclude |
Registers a script include tag into the page for an external script url. public void RegisterClientScriptInclude(Control control, Type type, string key, string url) public void RegisterClientScriptInclude(Control control, Type type, string url, ScriptRenderModes renderMode) |
|
RegisterClientScriptResource |
Returns a WebResource or ScriptResource URL for script resources that are to be embedded as script includes. public void RegisterClientScriptResource(Control control, Type type, string resourceName, ScriptRenderModes renderMode) |
|
RegisterCssLink |
Registers a CSS stylesheet in the page header and if that's not accessible inside of the form tag. public void RegisterCssLink(Control control, Type type, string key, string url) |
|
RegisterCssResource |
Registers a CSS Web Resource in the page public void RegisterCssResource(Control control, Type type, string resourceName) |
|
RegisterHiddenField |
Injects a hidden field into the page public void RegisterHiddenField(Control control, string hiddenFieldName, string hiddenFieldInitialValue) |
|
RegisterStartupScript |
Registers a startup code snippet that gets placed at the bottom of the page public void RegisterStartupScript(Control control, Type type, string key, string script, bool addStartupTags) |
|
Current |
Current instance of this class which should always be used to access this object. There are no public constructors to ensure the reference is used as a Singleton to further ensure that all scripts are written to the same clientscript manager. |
Requirements
Namespace: Westwind.WebAssembly: westwind.web.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic