I have a client script on a page, that calls a dynamic script generated by a user control using ClientScript.RegisterStartupScript. The user controls script is dynamic, the pages’ static.
The issue I have, is the page client script cant find the function rendered by the user control. The method signatures match, everything is good.
However, the user controls script is contained on the page after the static script. Would this make a difference? If so, is there a way to render the script before the static script – according to the MSDN api docs the only way is to combine all scripts into one.
I don’t have the luxury of doing this because the dynamic script uses the ClientID of the user control to uniquely identify itself – there is more than one occurrence of the user control.
Is there an easy way around this?
Cheers
My advise is that you make this “dynamic” script a static one that takes the control(s) id(s) as parameter. For example you could have something like:
And then on your code-behind, you can call this script as so: