JQuery in Ajax.Net Update Panel

27 04 2011

If you are a have a control with JQuery binding inside an Ajax.Net update panel, you will be stumped on as to why the JQuery stops working once the update panel is refreshed. The reason is that once the update panel refreshes, your Jquery binding is lost. This problem is simple to solve. Whenever an update panel refreshes, it calls javascript pageLoad() function. So all you need to do is place all your JQuery that needs rebinding inside this pageLoad function. Here is an example:

<script language=”javascript”>

function pageLoad()
{
RebindAll();
}

function RebindAll()
{
//Jquery that needs rebinding after postback
$.document.getReady(
//Some jquery stufff
);
}

</script>








Follow

Get every new post delivered to your Inbox.

Join 491 other followers