Last post was about how dynamic javascript in the update panel was not being re-executed on a partial postback. I have a better way of making it execute -- parse the controls in the UpdatePanel and call the javascript method eval().
Here is the hook:
Page.ClientScript.RegisterStartupScript(
EvalScript looks like this:
function EvalScript(control, id){ if(!control){return;} for(var n=0;n<control.children.length;n++) { if((control.children[n].tagName == 'SCRIPT') && (control.children[n].id == id)){ var scriptElement = control.removeChild(control.children[n]); eval(scriptElement.innerHTML); }else{ EvalScript(control.children[n], id); } }}
Basically EvalScript searchs client side all the controls in the updatepanel control for one with the name specified, then calls Eval on it's innerHTML. Just a note, you don't want inside comments in your <SCRIPT> tag, they don't eval() well.
{6230289B-5BEE-409e-932A-2F01FA407A92}
Remember Me
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Your Name Here
E-mail