Consider you have the following function in JS file:
| functiongetAlert() |
| { |
| alert('hi'); |
| } |
define the script file before the html tag of the aspx by adding the following line:
| <scriptsrc="FILENAME"type="text/javascript"></script> |
at your code behind (for example page load), add the following line
| Page.ClientScript.RegisterClientScriptBlock( |
| this.GetType(), |
| "callScript", |
| "getAlert();",true); |
You will find that on page load the function getAlert() is called. You can do the same in any method in the code behind.
Khaled Moawad --- http://kholyos.blogspot.com