Click here to Skip to main content
15,355,133 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to execute a java script function written on client side before execution of page_load() event
Plz some one help me....thanks
Updated 23-Apr-14 0:59am

Solution 1 has a link to your answer but I'll explain it here.

You can't do this, sort of.

When you visit a web page the first thing to happen is all of the C# runs and IIS/.Net generate html and send the html and any supporting files (css, images, javascript) to your browser and then your browsers parses it. At that point you can run JavaScript.

The reason I say sort of is because you can have JavaScript run before the page postsback and during a postback Page_Load runs again. Sometimes on a button click we run JavaScript to validate the form is filled in and then we let it postback at which point on the server side the Page_Load will run. This is the only way to do that but the way you are asking really does not make any sense.

Client and Server are totally disconnected.

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