Trying to Use Class

W

Wayne Wengert

I am trying to work through an ASP.NET book and in one example you build a
Class and then call a method from that class in an ASPX page. I put the
class file ("quote.dll") in the bin directory and then added the aspx page
that uses it to the project. When I re-open the project and right click on
the aspx file and select the "Add to Project" option I get an error stating:
"There is no class file associated with the WebForm 'ShowQuote.aspx'. Create
a new class file now?" I can see the class file in the bin directory and
I've verified that the namespaces match?

How can I debug/correct this condition? Is there some place I "associate" a
class file to an aspx page?

TIA

Wayne.
 
K

Kevin Spencer

Hi Wayne,

The class that Visual Studio.Net is referring to is the CodeBehind class.
VS.Net is designed to compile ASP.net apps, which entials using CodeBehind
files that are separate from the .aspx Page Templates. It sounds like you're
working on an ASP.Net Page that includes the CodeBehind code IN the page
file. The message is NOT referring to your other custom class, which is not
a Page class.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
W

Wayne Wengert

Thanks for the response Kevin.

VSNET creates two files in the Bin directory; myProj.dll and myProj.pdb when
I import the aspx file. If I delete those files, they get recreated when I
build the project?

Wayne
 
K

Kevin Spencer

When Visual Studio compiles your code, it creates a DLL with the class
definition(s) inside it, and the ASPX page uses that compiled class as its'
CodeBehind. The .pdb file is the debugging database for that assembly.
Visual Studio.Net will compile all of your CodeBehind files into this one
DLL, creating a single Class Library for your entire app.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
W

Wayne Wengert

Kevin;

Thanks. I'll do some more digging to see if I can figure out what is going
on.

Wayne
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top