Demon Cleaner
02-06-2007, 07:36 AM
Hi guys.
I'm trying to create a class which will allow me to have access to a masterpage's objects. Here is the code I'm using
(notes: my project's name is myPro and my masterpage's name is MasterPage)
Imports myPro.MasterPage
Imports System.Web.UI.Page
Public Class authorization_layer
Public a As New myPro.MasterPage
Public x As New System.Web.UI.Page
Public Function Retrive_User_Privilages(ByVal x As Integer)
CType(x.Master, a).TheMainInfoLabel = "blabla"
End Function
End Class
In the MasterPage.Master.vb i put some code to make a label's text property public
Public Property TheMainInfoLabel() As String
Get
Return Label6.Text
End Get
Set(ByVal value As String)
Label6.Text = value
End Set
End Property
I call my function as following
Dim auth As New authorization_layer()
auth.Retrive_User_Privilages(1)
Well, the above code doesn't work. I'm getting an error (VS Studio 2005) in this line
CType(x.Master, a).TheMainInfoLabel = "blabla"
saying that :
Type "a" is not defined
Can someone give a hint here cause I'm little confused. :-\
Thanks in advance.
I'm trying to create a class which will allow me to have access to a masterpage's objects. Here is the code I'm using
(notes: my project's name is myPro and my masterpage's name is MasterPage)
Imports myPro.MasterPage
Imports System.Web.UI.Page
Public Class authorization_layer
Public a As New myPro.MasterPage
Public x As New System.Web.UI.Page
Public Function Retrive_User_Privilages(ByVal x As Integer)
CType(x.Master, a).TheMainInfoLabel = "blabla"
End Function
End Class
In the MasterPage.Master.vb i put some code to make a label's text property public
Public Property TheMainInfoLabel() As String
Get
Return Label6.Text
End Get
Set(ByVal value As String)
Label6.Text = value
End Set
End Property
I call my function as following
Dim auth As New authorization_layer()
auth.Retrive_User_Privilages(1)
Well, the above code doesn't work. I'm getting an error (VS Studio 2005) in this line
CType(x.Master, a).TheMainInfoLabel = "blabla"
saying that :
Type "a" is not defined
Can someone give a hint here cause I'm little confused. :-\
Thanks in advance.