如果双击WebForm以后vs2005可以自动生成下面这个方法  
  protected void Page_Load(object sender, EventArgs e)
    {    }
可是这个方法在什么时候被调用的哪?自动调用吗,如果改动名称,系统就不会调用了,好像只调用名称为Page_Load的方法,那位高手能讲解一下,不胜感激

解决方案 »

  1.   

    asp.net 2.0的编译模式
    http://www.microsoft.com/china/msdn/library/webservices/asp.net/dnvs05Internals.mspx
      

  2.   

    page_load是加载aspx文件,好象和window.onload差不多吧
      

  3.   

    楼主也是刚学面向对象吧?
    呵呵 一块进步吧
    Page_Load 方法在页面Load事件的回调方法
    其实一个页面也是一个服务器控件罢了
    楼主要熟悉一下C#中代理,事件等概念
      

  4.   

    你还是去看哈ASP。NET页面的生命周期的10个事件那篇文章吧
      

  5.   

    在 自动生成的代码中有一个委托引入了这个函数的指针给一个事件.lz去了解下asp.net中的事件冒泡比较清楚.以下是一次请求的事件执行顺序.
    http://community.csdn.net/Expert/topic/4666/4666039.xml?temp=.6554682
    --------------------------------
    Page calls Construct
    Page finishes Construct
    Page calls New
    Page finishes New
    Page calls DeterminePostBackMode
    Page finishes DeterminePostBackMode
    Page calls AddParsedSubObject
    Page calls CreateControlCollection
    Page finishes CreateControlCollection
    Page calls AddedControl
    Page finishes AddedControl
    Page finishes AddParsedSubObject
    ChildControl calls Construct
    ChildControl finishes Construct
    ChildControl calls New
    ChildControl finishes New
    * -- Page parses templated properties here and calls Set for those properties on the ChildControl (e.g., <tag:namespace id=?idName? runat=?server? FirstName=?Adam? LastName=?Wayne? DisplayBothNames=?True? />)
    Page calls AddParsedSubObject
    Page calls AddedControl
    Page finishes AddedControl
    Page finishes AddParsedSubObject
    Page calls AddParsedSubObject
    Page calls AddedControl
    Page finishes AddedControl
    Page finishes AddParsedSubObject
    ChildControl calls OnInit
    ChildControl raises Init
    ChildControl finishes OnInit
    ChildControl calls TrackViewState
    ChildControl finishes TrackViewState
    Page calls OnInit
    Page raises Init
    Page finishes OnInit
    Page calls TrackViewState
    Page finishes TrackViewState
    Page calls OnLoad
    Page raises Load
    Page finishes OnLoad
    ChildControl calls OnLoad
    ChildControl raises Load
    ChildControl finishes OnLoad
    Page calls EnsureChildControls
    Page calls CreateChildControls
    Page finishes CreateChildControls
    Page finishes EnsureChildControls
    Page calls OnPreRender
    Page raises PreRender
    Page finishes OnPreRender
    ChildControl calls EnsureChildControls
    ChildControl calls CreateChildControls
    ChildControl finishes CreateChildControls
    ChildControl finishes EnsureChildControls
    ChildControl calls OnPreRender
    ChildControl raises PreRender
    ChildControl finishes OnPreRender
    Page calls SaveViewState
    Page finishes SaveViewState
    ChildControl calls SaveViewState
    ChildControl finishes SaveViewState
    Page calls SavePageStateToPersistenceMedium
    Page finishes SavePageStateToPersistenceMedium
    Page calls CreateHtmlTextWriter
    Page finishes CreateHtmlTextWriter
    Page calls Render
    Page finishes RenderChildren
    ChildControl calls Render
    ChildControl calls RenderChildren
    ChildControl finishes RenderChildren
    ChildControl finishes Render
    Page finishes RenderChildren
    Page finishes Render
    ChildControl calls OnUnload
    ChildControl raises Unload
    ChildControl finishes OnUnload
    Page calls OnUnload
    Page raises Unload 
    Page finishes OnUnload
      

  6.   

    Page_load()使页面加载时产生事件
    不可以改名字