Code behind page - Newbie question

  • Thread starter Chris Kettenbach
  • Start date
C

Chris Kettenbach

This is a stupid question, but how do I get a code behind to be recognized?
I used @Page and src="", but Visual Studio does not recognize the src
attribute. It says I need to build, the class first and reference it. How
do I get it compiled and in to the bin directory? Thanks everyone.

Chris Kettenbach
 
B

Brock Allen

VS.NET keys off of the CodeBehind="YourPage.cs" directive. ASP.NET ignores
this. Src="YourPage.cs" asks ASP.NET to compile the source file at runtime,
which is not what you want if you're using VS.NET, as it will already have
compiled it ahead of time (when you do a build in VS.NET).
 
G

Guest

src="" is dynamic compilation. It works with ASP.NET, but not within the IDE.
If you head this direction, you will have to deploy outside of Visual Studio
..NET.

For Visual Studio ,NET Codebehind=pagename.aspx.vb (or .cs) is the way to
specify CodeBehind. In addition, you need Inherits="ProjectName.ClassName"
(for example (MyNamespace.Default). For ClassName, take a look at the name of
the class in the CodeBehind file you are linking.

NOTE: If you have problems with this, add the .aspx files only. When you add
them, it will ask if you wish to make the class file. Then, close Visual
Studio and copy the class files you are trying to link to the pages into that
folder and reopen Visual Studio.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top