Tuesday, May 13, 2008

Using JQuery with Microsoft AJAX.NET

Symptom:

$(document).ready(
function()
{
///
///execute only when a full page refresh.
///

});


ready() function executes only when a page does a full page refresh not when it does a partial page refresh inside a update panel

Solution:


<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>

<div class="rounded">
Welcome to Microsoft AJAX.Net
<asp:Button ID="Button1" runat="server" Text="Button" CssClass="button" />
</div>
<script type="text/javascript" language="javascript">
Sys.Application.add_load(functionNeedToBeExecuted);
function functionNeedToBeExecuted ()
{
// code need to be executed ....
}
</script>

</ContentTemplate>
</asp:UpdatePanel>

0 comments: