I'm not sure if this is the best way to do this, but for my custom controls using javascript, I have a public row property in the user control and register it on the page.
// sudo code
eg. Usercontrol
{ public bool CustomBool { get {
On the page
{ page load() { if (Usercontrol.CustomBool) { ScriptManager.RegisterStartupScript(this, typeof(string), "alertbox", UserControl.Javascript, true); } } }
The disadvantage of this is the need to remember the scripts on the page. it works though
source share