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>

Advertisements

Actions

Information

3 responses

10 05 2011
corporations offshore

Lets look at a simple but non-trivial example of combining JQuery UI Dialog Asp.Net and AJAX Update Panel. The first thing you will notices is when setting up the JQuery dialog we are adding a open event to attach the dialog div to the form element. The odd behavior of jQuery and the UpdatePanel was driving me crazy……

10 05 2012
Bhavin Shah (@iambhavin)

thanks a lot….. thanks…

13 07 2013
Abdurrahman

perfect

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: