adding a vb codefile in visual studio 2005 - context is not a member of xxx

J

jobs

stupid question which I once think I had the answer to I'm sure.

I create webform page with no codebehind.

I then decide I want to create a codebehind for it.

How can I do it so that it falls under the aspx page and does give met
hat context error>

I tried creating the .vb file, and making sure the directive on the
aspx page points to it, but vs.net does not neatly place it under the
aspx page. I tried refreshing , ect..

Imports system.web.security.membership
Imports system.web.security.Roles


when i do a view code it does open the new codefile, but the
directive line on the aspx reads 'context is not a member of xxx.'

I noticed, i have the same problem if i move the vb codefile out and
then back into a directory in vs.net 2005.

Thanks for any help or information.
 
J

Juan T. Llibre

There are no tools to convert inline code to code-behind.

Backup your file to another directory; delete the original file;
create a new file with the same name as your original file and make sure
you select the "Place code in separate file" option in the VS 2005 IDE.

Then, re-create your objects in the web form file.
The VS 2005 IDE will create the necessary code-behind.

When you're done, add your custom code to the code-behind file.
Sorry, I wish I had better news for you.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
M

Masudur

stupid question which I once think I had the answer to I'm sure.

I create webform page with no codebehind.

I then decide I want to create a codebehind for it.

How can I do it so that it falls under the aspx page and does give met
hat context error>

I tried creating the .vb file, and making sure the directive on the
aspx page points to it, but vs.net does not neatly place it under the
aspx page. I tried refreshing , ect..

Imports system.web.security.membership
Imports system.web.security.Roles

when i do a view code it does open the new codefile, but the
directive line on the aspx reads 'context is not a member of xxx.'

I noticed, i have the same problem if i move the vb codefile out and
then back into a directory in vs.net 2005.

Thanks for any help or information.

hi...

I know its funny problem...
But it happens some time...
well you got to create a file... with name
lets say for default.aspx.vb for default.aspx page...
then in @page directive add codefile as your class names path and
inharits as the class in side the vb file...
oh one more thing... the class must be inharited from
system.web.ui.page

thats it you are good to go...

Thanks
Masudur
http://munnacs.110mb.com
 

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

Top