Been making a few experiments with the famous PortalSiteCS demo in order to try to understand some problems I am having with the app I am developing.
I made two simple modifications:
1) added the following script to news.ascx
alert('Hey, someone has called theFunction!!!');
2) added one button to the end of the form in default.aspx
<input type="button" onclick="theFunction();" />
The problem is that the button cannot actually call theFunction when you start clean and just add one 'news widget' - but no script error is caught at the browser.
But the story gets completely different after a postback (a page reload or whatever). After an 'F5' the button is actually able to call theFunction.
This seems related to the problems I'm getting in my app. So... my question is: how can I ensure that the user control scripts get loaded right when the widget is created for the 'first time'? - in this case via the add dock button.
Hope my description is clear enough. Thanks,