By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

Pgae Directive

P: n/a
Is the Page directive only go on ".aspx" pages? I think the answer is yes,
but I am not positive. I am trying to figure out why a called class can not
be found and I was wondering if I should place a page directive on the class
which I am trying to call.

In my situation I have "MyPage.aspx" which has code behind page called
"MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the
"MyClass.vb" can not be found. All my code is source code, not compiled code,
so I am using the page directive of @Page Inherits="MyPage"
src="MyPage.aspx.vb". When "MyPage.aspx.vb" instatiates "MyClass.vb" it fails
with a compile error.

I have taken the "MyClass.vb" and created a new project and compiled the code
as a new project and placed that dll into the bin folder, but then I get an
error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly src="MyClass.vb", but
this has no effect.

How can I resolve this error allowing the source code to be compiled on the
fly?
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
First, yes, the page directive is only good in ASPX pages. Second, you can't
reference code behind pages from other code behind pages without compiling
them. You either have to put all of that code in one file or you have to
write it so it doesn't reference each other. Or you have to compile all but
one and put the compiled code in the /bin directory.

Jerry

"Jim Heavey" <Ji*******@hotmail.com> wrote in message
news:OL**************@tk2msftngp13.phx.gbl...
Is the Page directive only go on ".aspx" pages? I think the answer is yes, but I am not positive. I am trying to figure out why a called class can not be found and I was wondering if I should place a page directive on the class which I am trying to call.

In my situation I have "MyPage.aspx" which has code behind page called
"MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the
"MyClass.vb" can not be found. All my code is source code, not compiled code, so I am using the page directive of @Page Inherits="MyPage"
src="MyPage.aspx.vb". When "MyPage.aspx.vb" instatiates "MyClass.vb" it fails with a compile error.

I have taken the "MyClass.vb" and created a new project and compiled the code as a new project and placed that dll into the bin folder, but then I get an error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly src="MyClass.vb", but this has no effect.

How can I resolve this error allowing the source code to be compiled on the fly?

Nov 17 '05 #2

P: n/a
Then what is the purpose of the "<%@ Assembly" directive?
That directive allows you to link together application and
it as a "src=" option which seems to imply that you can
have strait source rather then compiled code.

Am I missing something?
-----Original Message-----
First, yes, the page directive is only good in ASPX pages. Second, you can'treference code behind pages from other code behind pages without compilingthem. You either have to put all of that code in one file or you have towrite it so it doesn't reference each other. Or you have to compile all butone and put the compiled code in the /bin directory.

Jerry

"Jim Heavey" <Ji*******@hotmail.com> wrote in message
news:OL**************@tk2msftngp13.phx.gbl...
Is the Page directive only go on ".aspx" pages? I think the answer is
yes,
but I am not positive. I am trying to figure out why a
called class cannot
be found and I was wondering if I should place a page
directive on theclass
which I am trying to call.

In my situation I have "MyPage.aspx" which has code
behind page called "MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the "MyClass.vb" can not be found. All my code is source code, not compiledcode,
so I am using the page directive of @Page
Inherits="MyPage" src="MyPage.aspx.vb". When "MyPage.aspx.vb"

instatiates "MyClass.vb" itfails
with a compile error.

I have taken the "MyClass.vb" and created a new project
and compiled thecode
as a new project and placed that dll into the bin
folder, but then I getan
error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly
src="MyClass.vb",but
this has no effect.

How can I resolve this error allowing the source code
to be compiled onthe
fly?

.

Nov 17 '05 #3

P: n/a
You're missing the fact that the assembly will only be visible in the page
that contains the directive, but not in other assemblies you include in the
same page. To have the assemblies see each other you have to compile them
and use Using Assembly.Name (in C#) within the assembly files.

Jerry

"Jim Heavey" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Then what is the purpose of the "<%@ Assembly" directive?
That directive allows you to link together application and
it as a "src=" option which seems to imply that you can
have strait source rather then compiled code.

Am I missing something?
-----Original Message-----
First, yes, the page directive is only good in ASPX

pages. Second, you can't
reference code behind pages from other code behind pages

without compiling
them. You either have to put all of that code in one file

or you have to
write it so it doesn't reference each other. Or you have

to compile all but
one and put the compiled code in the /bin directory.

Jerry

"Jim Heavey" <Ji*******@hotmail.com> wrote in message
news:OL**************@tk2msftngp13.phx.gbl...
Is the Page directive only go on ".aspx" pages? I think the answer is
yes,
but I am not positive. I am trying to figure out why a

called class can
not
be found and I was wondering if I should place a page

directive on the
class
which I am trying to call.

In my situation I have "MyPage.aspx" which has code

behind page called "MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the "MyClass.vb" can not be found. All my code is source code, not compiled
code,
so I am using the page directive of @Page

Inherits="MyPage" src="MyPage.aspx.vb". When "MyPage.aspx.vb"

instatiates "MyClass.vb" it
fails
with a compile error.

I have taken the "MyClass.vb" and created a new project

and compiled the
code
as a new project and placed that dll into the bin

folder, but then I get
an
error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly

src="MyClass.vb",
but
this has no effect.

How can I resolve this error allowing the source code

to be compiled on
the
fly?

.

Nov 17 '05 #4

P: n/a
I hope I understood you question correctly. To use the class, you will
have to Import the namespace that the class is in. If the class is in a
DLL then you will have to add it to the references of the project.

Jalil Vaidya

Jim Heavey wrote:
Is the Page directive only go on ".aspx" pages? I think the answer is yes,
but I am not positive. I am trying to figure out why a called class can not
be found and I was wondering if I should place a page directive on the class
which I am trying to call.

In my situation I have "MyPage.aspx" which has code behind page called
"MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the
"MyClass.vb" can not be found. All my code is source code, not compiled code,
so I am using the page directive of @Page Inherits="MyPage"
src="MyPage.aspx.vb". When "MyPage.aspx.vb" instatiates "MyClass.vb" it fails
with a compile error.

I have taken the "MyClass.vb" and created a new project and compiled the code
as a new project and placed that dll into the bin folder, but then I get an
error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly src="MyClass.vb", but
this has no effect.

How can I resolve this error allowing the source code to be compiled on the
fly?


Nov 17 '05 #5

P: n/a
I hope I understood you question correctly. To use the class, you will
have to Import the namespace that the class is in. If the class is in a
DLL then you will have to add it to the references of the project.

Jalil Vaidya

Jim Heavey wrote:
Is the Page directive only go on ".aspx" pages? I think the answer is yes,
but I am not positive. I am trying to figure out why a called class can not
be found and I was wondering if I should place a page directive on the class
which I am trying to call.

In my situation I have "MyPage.aspx" which has code behind page called
"MyPage.aspx.vb" and "MyPage.aspx.vb" instatiates "Myclass.vb" and the
"MyClass.vb" can not be found. All my code is source code, not compiled code,
so I am using the page directive of @Page Inherits="MyPage"
src="MyPage.aspx.vb". When "MyPage.aspx.vb" instatiates "MyClass.vb" it fails
with a compile error.

I have taken the "MyClass.vb" and created a new project and compiled the code
as a new project and placed that dll into the bin folder, but then I get an
error of "Invalid Type" when the class is instatiated.

I have tried using the @Assembly directive of @Assembly src="MyClass.vb", but
this has no effect.

How can I resolve this error allowing the source code to be compiled on the
fly?


Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.