Tuesday, May 13, 2008

How to jQuery with Asp.net Ajax

Symptom:

<script language="javascript">
    $(document).ready(function () {
        ///
        ///execute only when a full page refresh.
        ///
    });
</script>

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 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>

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...