0

I'm using VS2008 and want to create a web application (not a web site) with Code-Beside but, the default mode of aspx is Code-Behind. I have tried to change the CodeBehind=ClassFile.cs to CodeFile=ClassFile.cs in the header of aspx's <%@Page%> part, and deleted the aspx.designer.cs file,but if I added a server control to the page, the compiler is also send me an error of no member defined.the cs file is the orinal file of codebehind, it is partial class.

1
  • but, why asp.net website doesn't need the designer.cs file, it looks tidy. Commented Dec 6, 2009 at 11:18

2 Answers 2

1

You don't want to delete aspx.designer.cs you want to delete the aspx.cs file, then place a similar file next to it and declare it as a partial class. designer.aspx.cs is still required to provide you direct access to controls placed within the page, rather than going through FindControl.

Sign up to request clarification or add additional context in comments.

Comments

0

You definitely don't want to delete the .designer.cs file, as this is where the server control definitions will be placed.

In general the codebehind model is much better as it makes the code easier to find, use and maintain.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.