Register client script at the end of the page.

A

Arjen

Hello,

I want that the client script is added at the and of the HTML output it is
now at the beginning.

Here is my code:
private void Page_Load(object sender, System.EventArgs e)
{
RegisterClientScript();
}

/// <summary>
/// Registers ClientScript with the Page.
/// </summary>
protected virtual void RegisterClientScript() {
if( !Page.IsClientScriptBlockRegistered("PortalICT.WebControls.DCE
Library") ) {

ResourceManager manager = new ResourceManager( typeof(RichTextBox) );
String script =
manager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture,
true, true).GetString("LibraryScript");

this.Page.RegisterClientScriptBlock("PortalICT.WebControls.DCE Library",
script );
}
}



What do I have to change?

Thanks!
 
K

Kevin Spencer

Instead of RegisterClientScriptBlock, use RegisterStartupScript.
RegisterStartupScript puts the script block just above the </form> tag in
the page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.
 
A

Arjen

Okay, thanks!


Kevin Spencer said:
Instead of RegisterClientScriptBlock, use RegisterStartupScript.
RegisterStartupScript puts the script block just above the </form> tag in
the page.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top