Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can any one explain which code Executes first ? i.e Code in jquery Document .ready or in asp.net Page_Load method?

It would be a great help .. Thanks in advance
JavaScript
$(document).ready(function() {
      

});


C#
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
           
        }
    }
Posted
Updated 7-Feb-11 1:29am
v2

Before a page gets rendered to HTML the server side code has to run. So the obvious answer is that the Page_Load method is executed first. The jQuery code is executed when the page is loaded in the browser. To be more specific it is executed when the page has been loaded completely in the browser.

Best Regards,
Manfred
 
Share this answer
 
v4
Comments
Manas Bhardwaj 7-Feb-11 9:29am    
+5
Espen Harlinn 7-Feb-11 15:27pm    
An obvious 5
In addition to what Manfred said, you should try to understand the ASP.Net page lifecycle[^].
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 7-Feb-11 9:34am    
Agreed! 5+
This is actually one of the first things an aspiring ASP.NET developer must know about.
Espen Harlinn 7-Feb-11 15:28pm    
Required knowledge, a 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900