ASP.net update panel’s and jQuery


I had a problem today with buttons in an update panel and jQuery- there are some buttons which get hidden or displayed depending on the user’s OS – mac or pc users basically get shown different instructions- However because these buttons are added by a partial post back of the update panel, the jQuery document.ready had already fired before these buttons existed.

So I experimented adding the code to the form.submit event but in the end found the solution on google; I simply added this;

<script type='text/javascript'>
function pageLoad(sender, args)
{
    // your code here..
    showHideMacLinks();
}
</script>

This handles the pageLoad event raised by my update panel which is fired on the initial load and on the partial post back.¬† You can filter this to only fire on partial post back by adding¬† “if(args.get_isPartialLoad())”

Found this over on the .net Funda blog

  1. No comments yet.
(will not be published)