RegisterClientScriptBlock with rendered control?

M

Martin

Hi,

Are there any issues using ClientScriptManager.RegisterClientScriptBlock in
a rendered control?

I'm calling this function within the overriden Render method of my
WebControl, but nothing the script is not coming out in my page source.
After calling RegisterClientScriptBlock, a call to
IsClientScriptBlockRegistered confirms the script block is registered.

Any ideas?

Thanks
Marti
 
T

Teemu Keiski

Using these in render method is too late since form has already begun
rendering (scrips to be rendered are sort of fixed at that point already).
Do registration in OnPreRender/PreRender stage.
 
M

msnews

Are you expecting to see something no the web page or just in the HTML
source?

Normally this will place a script reference in your code which you cannot
see. Try placing a Javascript alert into the script to see if that is
fired.

Brennan Stehling
http://brennan.offwhite.net/blog/
 

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,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top