We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Asp.Net Execute Javascript in an Update Panel

Rockfabrik
Rockfabrik asked
on
Medium Priority
726 Views
Last Modified: 2012-05-06
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
Comment
Watch Question

Analyst Programmer
Commented:
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...  )

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.