Output script

A

Ahmed Hashish

I have created a server control and overridden the sub Render to output
JavaScript functions, the problem that if the client used two instances of
my control the control generates the JavaScript functions twice which cause
a lot of problems, how could I solve this problem?


Ahmed
 
B

Brock Allen

Don'e emit javascript in Render. Instead call Page.RegisterClientScriptBlock
from Page_Init or Page_Load.
 
A

Ahmed Hashish

Is there is a way to emit the script from my server control using function
RegisterClientScriptBlock ?

Ahmed
 
B

Brock Allen

Yes, it's Page.RegisterClientScriptBlock -- "Page" is a property of your
control that returns a reference to the containing page object.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top