C
Corey B
Is there a way for an instance of a custom class to access an ASPX page
level variable? I know that I can access a Session variable from
within a class using the following code:
myClassVar =
System.Web.HttpContext.Current.Session.Item("mySessionVar")
But I can't figure out if it is possible to access a page level
variable from within a class.
For example, let's say I had the following code for my ASPX page:
Public Class myPage
Inherits System.Web.UI.Page
Public myPageVar as String
Private Sub Page_Load (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
myPageVar = "My Test"
Dim myObject as New myClass()
End Sub
End Class
And that I had the following code for a custom class:
Public Class myClass
Private _localVar as String
Public Sub New()
MyBase.New()
_localVar = ????????? (How do I access the variable myPageVar on
the ASPX page?)
End Sub
End Class
Any help would be greatly appreciated.
Thanks,
Corey
level variable? I know that I can access a Session variable from
within a class using the following code:
myClassVar =
System.Web.HttpContext.Current.Session.Item("mySessionVar")
But I can't figure out if it is possible to access a page level
variable from within a class.
For example, let's say I had the following code for my ASPX page:
Public Class myPage
Inherits System.Web.UI.Page
Public myPageVar as String
Private Sub Page_Load (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
myPageVar = "My Test"
Dim myObject as New myClass()
End Sub
End Class
And that I had the following code for a custom class:
Public Class myClass
Private _localVar as String
Public Sub New()
MyBase.New()
_localVar = ????????? (How do I access the variable myPageVar on
the ASPX page?)
End Sub
End Class
Any help would be greatly appreciated.
Thanks,
Corey