Basically I want to get some javascript to be sent back to the client and executed from a postback inside an UpdatePanel. Furthermore this is inside of a reusable WebControl.
I've tried this.Page.ClientScript.RegisterStartupScript
and this.Page.ClientScript.RegisterClientScriptBlock
but Firebug shows that those scripts aren't sent back in the postback's response.
I also tried straight up writing a <script>
tag inside the control's main div in the Render
method, which does get sent back but isn't executed.
I got a hacky solution working, but ideally looking for a cleaner solution. The hack is to add a 1x1 pixel img
with width/height set to 0 and use that for an onload
event to execute the script and that works, but it seems like there has to be a cleaner way to do this.