Asp.Net Execute Javascript in an Update Panel

Hello,


i want to execute Javascript in an Update Panel.

<update panel 1 />
<update panel 2 />

if the panel 2 sends an callback, some javascript should be shown.

i'm using asp.net
best regards
Martin
RockfabrikAsked:
Who is Participating?
 
David RobitailleConnect With a Mentor Analyst ProgrammerCommented:
I dont know if you have many trigger to the update panel 2, but you could use something like on this one.
http://vincexu.blogspot.com/2008/10/how-to-make-modalupdate-progress-bar-on.html
the intersting part is there :
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function(sender, e)
{
if (e.get_postBackElement().id == "<%= GridView1.ClientID %>") // This line can make sure only the request from GridView1 will present popup panel, you can change it to other control client id.
{
$find('modalbehavior').show();
}
});

</script>
it run a script at each postback and it check the postBackElement().id to show the popup. so you could replace the $find('modalbehavior').show(); with your script and "<%= GridView1.ClientID %>")  with all the control that trigger the update (The all the control part may be a problem to you...  )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.