July 30, 2002 - onload Event Handler | 2 | WebReference

July 30, 2002 - onload Event Handler | 2

Yehuda Shiran July 30, 2002
onload Event Handler
Tips: July 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

ASP.NET pages may include JScript .NET code, much the same as an HTML page may include JavaScript code. JScript .NET uses the intrinsic event handler, Page_Load():

  public function Page_Load(sender:Object, E:EventArgs) : void {
    resultControl.Enabled = false;
  }
The server always runs the Page_Load() function when loading an ASP.NET page. The name of the function should always be Page_Load() or else the server won't do what you want it to do when loading the page. In this particular case, we disable the result ASP:TEXTBOX field (resultControl), because it is used only for displaying a calculation result:

  resultControl.Enabled = false;
To learn more about JScript .NET and ASP.NET, go to Column 113, JScript .NET, Part VII: Consuming add from ASP.NET.