Displaying data on web page, but passed by inherited class...please read 4 more info
I have a class called ApplesBase:
VB Code:
Public Class ApplesBase
Inherits System.Web.UI.Page
Public Sub New()
Call LinkToApples
End Sub
Private Sub LinkToApples()
'code here to do stuff
End Sub
End Class
My web pages now inherit from this:
VB Code:
Public Class EnteringSite
Inherits ApplesBase
'code for web page
End Class
Now in the function LinkToApples I want something like:
VB Code:
Private Sub LinkToApples()
If NoPermissions Then
Response.Write "Woof"
End If
End Sub
This is not possible to use the response object in this sense, inside an inherited class that is.
I could I suppose redirect to another page, but I don't want to do this.
Any ideas?
Woof
Re: Displaying data on web page, but passed by inherited class...please read 4 more info
This is the best I could come up with - placing the code in an ordinary class. I cannot see a single way to get this from an inheriting class...
VB Code:
Public Class EnteringSite
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
dim NewApplesBaseRef as ApplesBase = new ApplesBase
If not (NewApplesBaseRef is nothing) Then
Select Case NewApplesBaseRef.PermissionsRetreived
Case ApplesBase.enumPermissionsRetreived.NoPermissions
Response.Write("woof!")
End Select
NewApplesBaseRef = nothing
End If
End Sub
End Class
Public Class ApplesBase
Inherits System.Web.UI.Page
Private CurrentPermissions as enumPermissionsRetreived
Public Enum enumPermissionsRetreived
NoPermissions = 0
End Enum
Public ReadOnly Property PermissionsRetreived as enumPermissionsRetreived
Get
Return CurrentPermissions
End Get
End Property
Public Sub New()
Call LinkToApples
End Sub
Private Sub LinkToApples()
' Do permissions check / login routine here & return a value.
CurrentPermissions = enumPermissionsRetreived.NoPermissions
End Sub
End Class
Re: Displaying data on web page, but passed by inherited class...please read 4 more info
Hmmm by your method my main web page would not inherit my base page?
Woka
Re: Displaying data on web page, but passed by inherited class...please read 4 more info
Sorry Woka, I can't see any way to do this using inheritance!!!
If I use that above & try & grab at the property from ANY overridden methods within the EnteringSite, it doesn't work! Can't think of another way you're going to be able to do this one...