EAPUtilRegisterClientScriptBlock Method |
Register a script block (assumed to be javascript) with the page.
This method is normally used to register javascript function definitions, but not code to be executed
immediately, as this code will be injected early in the page's HTML and generally will be executed by
the browser's javascript engine before the page has finished loading. Script that should be executed
once the page finishes loading and the DOM has been rendered should be registered using
RegisterStartupScript(Page, String, String). For registering HTML, use
RegisterClientHtmlBlock(Page, String, String).
You can register script residing in a disk file using
RegisterClientScriptFile(Page, String, String).
Use
IsClientScriptBlockRegistered(Page, String) to determine if the block is aready registered.
Namespace:
NetQuarry
Assembly:
EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntaxpublic static void RegisterClientScriptBlock(
Page pg,
string name,
string script
)
Public Shared Sub RegisterClientScriptBlock (
pg As Page,
name As String,
script As String
)
Parameters
- pg
- Type: System.Web.UIPage
The page on which to register the script - name
- Type: SystemString
The name of the script - script
- Type: SystemString
The script block (without the script start and end tags)
Remarks
Once a particular script block, by name, has been registered on a page, subsequent
registrations under that name are ignored. There is no way to, essentially, replace a block once
registered.
Remarks
A wrapping <script> tag is optional and will be provided by this method if necessary.
See Also