"Jon" <co****@columbusinteractive.com> wrote in message
news:hX*****************@fe1.columbus.rr.com...
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message The base page idea works if you don't put any controls in the base page.
However, you can put a property in the base page. Such a property can
contain the code to check for Nothing, so that it doesn't have to be
repeated on each page.
John Saunders
I made the following base class and inherit from it and get the deisnger
error. It contains nothing except code to check the session. It's simply
a class file.
....
Sorry, I just tested with VS2002 and I see that you're right. My experience
was with a base class for UserControls, which works.
The test I did was to create an entirely empty base class (not even a
constructor) which inherits Page. My derived page inherited my base page.
This caused no error from the designer, but the all of the items on the
toolbox "Web Forms" tab were disabled. Strangely, the items on the "HTML"
tab were all enabled and I was able to drag them to the page. Even stranger,
I was able to enter <asp:Label> in the HTML, and see it rendered in the
designer (though I couldn't select it). It works just fine for user
controls, and works for pages in VS2005 Beta 1 (add Inherits="BasePage" to
the <%@ Page %> directive).
Since inheritance doesn't work, a thought is to not inherit from the "base
class", but to have each page contain an instance of it. For instance,
instead of
Public Class WebForm2
Inherits BasePage
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AccessCheck() ' MyBase.AccessCheck()
End Sub
End Class
use
Public Class WebForm2
Inherits System.Web.UI.Page
Private _base As New BasePage()
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
_base.AccessCheck()
End Sub
End Class
John Saunders