M
mpaine
I have read
http://msdn2.microsoft.com/en-us/library/ms178472(VS.80).aspx and my
interpretation is that custom events should be fired between Page_Load
and Page_LoadComplete. When I run the following sample code, the
custom events are always last. Why is that?
Your help will be greatly appreciated!
<%@ Page Language="VB" AutoEventWireup="false" Title="Test ASP.NET Life
Cycle"
EnableEventValidation="false" %>
<script language="vb" runat="server">
Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text = "PreLoad" & "<br/>"
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "Load" & "<br/>"
End Sub
Protected Sub Submit_OnCommand(ByVal sender As Object, ByVal Args
As CommandEventArgs)
test.Text &= "OnCommand" & "<br/>"
End Sub
Protected Sub Reload_OnCommand(ByVal sender As Object, ByVal Args
As CommandEventArgs)
Response.Redirect(HttpContext.Current.Request.ServerVariables("SCRIPT_NAME"))
End Sub
Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "LoadComplete" & "<br/>"
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "PreRender" & "<br/>"
End Sub
</script>
<HTML>
<body>
<form id="aForm" runat="server">
<asp:Button ID="Reload" runat="server" Text="Reload"
runat="server"
UseSubmitBehavior="true" EnableViewState="true"
OnCommand="Reload_OnCommand"
CommandArgument=''
CommandName="reload" /><br />
<asp:Button ID="Submit" runat="server" Text="Submit"
runat="server"
UseSubmitBehavior="true" EnableViewState="true"
OnCommand="Submit_OnCommand"
CommandArgument=''
CommandName="post" /><br />
<asp:Label ID="test" runat="server"></asp:Label>
</form>
</body>
</HTML>
http://msdn2.microsoft.com/en-us/library/ms178472(VS.80).aspx and my
interpretation is that custom events should be fired between Page_Load
and Page_LoadComplete. When I run the following sample code, the
custom events are always last. Why is that?
Your help will be greatly appreciated!
<%@ Page Language="VB" AutoEventWireup="false" Title="Test ASP.NET Life
Cycle"
EnableEventValidation="false" %>
<script language="vb" runat="server">
Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text = "PreLoad" & "<br/>"
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "Load" & "<br/>"
End Sub
Protected Sub Submit_OnCommand(ByVal sender As Object, ByVal Args
As CommandEventArgs)
test.Text &= "OnCommand" & "<br/>"
End Sub
Protected Sub Reload_OnCommand(ByVal sender As Object, ByVal Args
As CommandEventArgs)
Response.Redirect(HttpContext.Current.Request.ServerVariables("SCRIPT_NAME"))
End Sub
Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "LoadComplete" & "<br/>"
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreLoad
test.Text &= "PreRender" & "<br/>"
End Sub
</script>
<HTML>
<body>
<form id="aForm" runat="server">
<asp:Button ID="Reload" runat="server" Text="Reload"
runat="server"
UseSubmitBehavior="true" EnableViewState="true"
OnCommand="Reload_OnCommand"
CommandArgument=''
CommandName="reload" /><br />
<asp:Button ID="Submit" runat="server" Text="Submit"
runat="server"
UseSubmitBehavior="true" EnableViewState="true"
OnCommand="Submit_OnCommand"
CommandArgument=''
CommandName="post" /><br />
<asp:Label ID="test" runat="server"></asp:Label>
</form>
</body>
</HTML>