Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird behavior on Page_Init()
Message
From
03/09/2006 22:05:46
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Weird behavior on Page_Init()
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01150641
Message ID:
01150641
Views:
74
If I have this in a page, an exception is thrown with the text page_init:
<script runat="server">
    Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        Throw New System.Exception("page_init")
    End Sub

    Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim loDataEntry As DataEntryPurchase = New DataEntryPurchase(oApp)
        loDataEntry.GenerateForm()
    End Sub
</script>
So far, so good, now, if I subclass this page and move the Page_Init() code in a class instead by doing this:

1. Add Inherits="Framework.Framework.WebForm" in the page declaration.

2. Add a small class for this:
Namespace Framework

    Public Class WebForm
        Inherits System.Web.UI.Page

        Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            Throw New System.Exception("page_init from the class")
        End Sub

    End Class

End Namespace
The exception is never thrown. Can someone explain me why in inheritance mode that the Page_Init() event is not fired but only in the page itself?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform