How do I register a Javascript function to run with every postback?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-03-17T14:27:53Z Indexed on 2010/03/17 14:31 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

I have a treeview in a user control. I need to run a javascript function with every synch postback to scroll the div it's in to the right position. I've got it working, but I think there has to be a "cleaner" way to do it. In the Page_Load function of the control, I have the following code. Is there a better way to do it?

ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "key" + DateTime.Now.Ticks, "RestorePosition();", true);

© Stack Overflow or respective owner

Related posts about asp

Related posts about .NET