Hi,
Stan SR wrote:
Hi,
I need to place some javascript code at the end of my aspx page.
How can I do that using the ClientScript.RegisterClientScriptBlock ?
Thanks
Stan
AFAIK, you cannot specify the location of the script block using the
ClientScript manager.
If you want the script to be executed only when the page is fully
loaded, pack your code in a function, use ClientScript to register the
script, and add a "onload" event to the "body" tag, to execute the
function. The "onload" event is called when the whole page is parsed and
rendered.
If you have a reason to place the script at a specific place, you can
override the "Render" method in the Page class, and instead of calling
"base.Render( writer );", you render all the controls in the children
controls collection using the RenderControl method. When all the
controls have been rendered, add your script tag using the
HtmlTextWriter provided to the Render method.
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering:
http://www.galasoft-LB.ch
PhotoAlbum:
http://www.galasoft-LB.ch/pictures
Support children in Calcutta:
http://www.calcutta-espoir.ch