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:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...