HOW TO SOLVE DOCUMENT.READY ON PARTIAL POSTBACK NOT WORKING IN ASP.NET

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 718  View(s)
Ratings:
Rate this:
I want to know How to  Solve document.ready on partial Postback not working  in asp.net.please tell me how to solve this 
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to Solve document.ready on partial Postback not working in asp.net

    the pageLoad() and  $(document).ready() events do the same.
    both methods seem too similar in simple example.
    but $(document).ready() and pageLoad() methods have very much differences in feture.
    I will explain differences between $(document).ready() and pageLoad() methods.

    $(document).ready()
    JQuery’s document.ready() method gets called as soon as DOM is ready .
     If your web page has large images, it will not wait for loading of images completely.
     Hence it may called before pageLoad() method.
    We can have multiple document.ready() methods on a single web page which will be called in coming sequence.

    <script type="text/javascript"> 
            $(document).ready(function () {
                $('#id').text('Working document ready');
            });
    </script>

    pageLoad() method gets called when all resources of the page have been fully loaded.
    if you have  large size images on web page then until all the images are not fully loaded on the page, pageLoad()
    method will not called. pageLoad() method is not browser compatible. We can have only one pageLoad() method on a single web page.

    <script type="text/javascript">
            function pageLoad() {
                $('#id').text('Working pageLoad');           
            }
    </script>

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PartialPostBack.aspx.cs" Inherits="Forumasp.PartialPostBack" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">

    <title></title>

    <script src="Scripts/jquery-2.1.4.js"></script>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <script type="text/javascript">

    function pageLoad() {

    $('#id').text('Working pageLoad');

    console.log('clicked');

    }

    $(document).ready(function () {

    $('#id').text('Working document ready');

    });

    </script>

    <asp:ScriptManager ID="ScriptManger1" runat="server" />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

    <div>

    <asp:Label ID="id" runat="server" Text="Label" ClientIDMode="Static"></asp:Label>

    <asp:Button ID="btnsubmit" runat="server" Text="Submit"/>

    </div>

    </ContentTemplate>

    </asp:UpdatePanel>

    </div>

    </form>

    </body>

    </html>

     

     

     

     

     

     

     

     

      Modified On Jan-04-2016 10:59:22 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!