473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Register client script at the end of the page.

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.Web Controls.DCE
Library") ) {

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

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

What do I have to change?

Thanks!
Nov 17 '05 #1
2 11403
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.

"Arjen" <bo*****@hotmail.com> wrote in message
news:bh**********@news2.tilbu1.nb.home.nl...
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.Web Controls.DCE
Library") ) {

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

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

What do I have to change?

Thanks!

Nov 17 '05 #2
Okay, thanks!
"Kevin Spencer" <ke***@takempis.com> schreef in bericht
news:OB*************@TK2MSFTNGP10.phx.gbl...
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.

"Arjen" <bo*****@hotmail.com> wrote in message
news:bh**********@news2.tilbu1.nb.home.nl...
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.Web Controls.DCE
Library") ) {

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

this.Page.RegisterClientScriptBlock("PortalICT.Web Controls.DCE

Library",
script );
}
}

What do I have to change?

Thanks!


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Darren Clark | last post by:
How does everyone register and access input objects on the client side? well... i suppose i am after some alternate ways... i use the following code to put the neccessary client javascript code...
2
by: Hardy Wang | last post by:
Hi, I have a page which will call RegisterStartupScript function to register a client script. I also need to remove it under some certain condition, is there a way? -- WWW:...
3
by: Hardy Wang | last post by:
Hi, By calling Page.RegisterClientScriptBlock, the JavaScript will be generated right after VIEWSTATE hidden field. Is there a way I can register my script to end of page instead beginning? --...
3
by: Goh | last post by:
Hi, May I know how to register a java script inside the <head> tag not the body? I found only got method that able register at the body like RegisterStartupScript and RegisterClientScriptBlock....
2
by: fredd00 | last post by:
Hi here is my problem i use master pages and content pages i would like for some content page to register a script that will trigger on the 'onUnload' of the web page
1
by: lourivas | last post by:
Hi, I create a class with a property called MyProperty that needs to register a client script if the value is set to true. When i change the property value to true i always receive a message...
6
by: Velislav | last post by:
Hi, I have a client script block, which is registered in my Page_Load. However a button may result in the need to change the script which I've registered. Obviously the OnClick event occurs...
3
by: dixonjm | last post by:
Hi, In my page load event i have:- RegisterClientScripts(); if (!Page.IsClientScriptBlockRegistered("BannerScript")) if (!IsPostBack) { ...
2
by: Ed Courtenay | last post by:
Reposting here as you can practically see the tumbleweed blow by in microsoft.public.dotnet.framework.aspnet.webcontrols.... I've got a very simple custom control that requires a small section of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.