Accessing class from codebehind

  • Thread starter Kristoffer Arfvidson
  • Start date
K

Kristoffer Arfvidson

Hi!
Don´t know If I ended up on the right server for this question, but Ive been looking for ever now for the answer, and please if somebody knows, please help me!

My problem is the following:
I have an aspx page, called: Page1.aspx
on top of this page I have the following written line:
<%@Page language="vb" AutoEventWireup="true" Debug="true" Trace="true" inherits="clsCodeBehindIndex" src="page1.aspx.vb" %>

ok, Now, I have a codebehind page called: Page1.aspx.vb inside witch I have for example:
imports system
imports system.web
imports system.web.ui
imports system.web.ui.webcontrols
imports system.web.ui.htmlcontrols
'imports N.clsClientInfo





public class clsCodeBehindPage
Inherits System.web.ui.page
public lbl as label

sub Page_Load(sender as object,e as eventargs)
lbl.Text = "page load in Code Behind"

end sub
end class


------------
ok, now, I have a third file called: clientinfo.vb witch is on a different dir on the server eg. "../Global/clientinfo.vb"
ok, This is a GLOBAL Class, witch will be accessed thruout the page and contains information about the current client. ok...

So, now to my question, HOW??? on earth do I connect to this class thru my codebehind page? (page1.aspx.vb) ??
I can access the page by using: <%@ Assembly src="../global/clientinfo.vb" %> (on the normal aspx page) BUT!
I cant get access to the class in the codebehind page, ONLY on my normal aspx page...

I try to access the class by typing (in the codebehind page):
Dim ClientInfo as new clsClientInfo
But I keep getting error messages...

OBS!
I cant use VS.NET since my homepage provider dosnt support dll´s, so, I need to make this work, somehow...

Any suggestions?

Please help me, I have been looking for a week now, and still havnt found any info about this... :(

Here comes some example code for the clientinfo.vb class:
Namespace N 'Declare the namespace N

Public Class clsClientInfo
#Region "Declarations"
Dim str_LoggedInName As String
#End Region

#Region "Logged in as (Properties)"

Property LoggedInName() As String
Get
Return str_LoggedInName
End Get
Set(ByVal Value As String)
str_LoggedInName = Value
End Set
End Property
#End Region

End Class
End Namespace

Yours: Kristoffer
P.s. Merry christmas to you all! D.s.
 
K

Kristoffer Arfvidson

Do you have to make it an UserClass to make it work???

Anybody?

Yours: Kristoffer...



in message
Hi!
Don´t know If I ended up on the right server for this question, but Ive been
looking for ever now for the answer, and please if somebody knows, please
help me!

My problem is the following:
I have an aspx page, called: Page1.aspx
on top of this page I have the following written line:
<%@Page language="vb" AutoEventWireup="true" Debug="true" Trace="true"
inherits="clsCodeBehindIndex" src="page1.aspx.vb" %>

ok, Now, I have a codebehind page called: Page1.aspx.vb inside witch I have
for example:
imports system
imports system.web
imports system.web.ui
imports system.web.ui.webcontrols
imports system.web.ui.htmlcontrols
'imports N.clsClientInfo





public class clsCodeBehindPage
Inherits System.web.ui.page
public lbl as label

sub Page_Load(sender as object,e as eventargs)
lbl.Text = "page load in Code Behind"

end sub
end class


------------
ok, now, I have a third file called: clientinfo.vb witch is on a different
dir on the server eg. "../Global/clientinfo.vb"
ok, This is a GLOBAL Class, witch will be accessed thruout the page and
contains information about the current client. ok...

So, now to my question, HOW??? on earth do I connect to this class thru my
codebehind page? (page1.aspx.vb) ??
I can access the page by using: <%@ Assembly src="../global/clientinfo.vb"
%> (on the normal aspx page) BUT!
I cant get access to the class in the codebehind page, ONLY on my normal
aspx page...

I try to access the class by typing (in the codebehind page):
Dim ClientInfo as new clsClientInfo
But I keep getting error messages...

OBS!
I cant use VS.NET since my homepage provider dosnt support dll´s, so, I need
to make this work, somehow...

Any suggestions?

Please help me, I have been looking for a week now, and still havnt found
any info about this... :(

Here comes some example code for the clientinfo.vb class:
Namespace N 'Declare the namespace N

Public Class clsClientInfo
#Region "Declarations"
Dim str_LoggedInName As String
#End Region

#Region "Logged in as (Properties)"

Property LoggedInName() As String
Get
Return str_LoggedInName
End Get
Set(ByVal Value As String)
str_LoggedInName = Value
End Set
End Property
#End Region

End Class
End Namespace

Yours: Kristoffer
P.s. Merry christmas to you all! D.s.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top