.Net Programmers: do you use Code Behind pages?

Train

Lifer
Jun 22, 2000
13,578
73
91
www.bing.com
Im still trying to get more into ASP.Net, even though im still tied to classic asp in a lot of applications, or cold fusion because my job uses it.

As for .Net, the code behind feature is obviously useful, but in some cases it just seems like it would be extra work, at what point does "good practice" of using code behind become just more files to maintain with no real benifit? has code behind every actually made anyones life easier? or has NOT using code behind offered any benifits? should i do a mix of code behind and non code behind pages on my next app?
 

rsd

Platinum Member
Dec 30, 2003
2,293
0
76
I came more from a C/C++ background (though I had a little experience in ASP), when I first started using .NET and at least to me, once I got used to it, it just makes more sense to use as much code-behind as you can. Obviously somethings are fine to write inline with the HTML, but imho it just seems messier when you mix a lot of code with HTML.

Obviously it depends on what you are doing too, but if you are writing code for event handlers (e.g. ItemDatabound, or some onclick event) it would seem cleaner to separate it (I'm not even sure if that stuff would work correctly if you wrote it inline--I never tried, but perhaps it would). Also you don't have the Intellisense if you are using VS, as you would in the code behind.
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
I have had a similar experience to rsd. I have done some development in the past with ASP, and found it quite aggrevating the way the code and the page were intermixed.

With ASP.NET I find things much more organized, and I have no problems finding what I need in the page or in the code for the page. I think this is mainly due to previously always dealing with standard Visual C++ GUI applications where you have your dialog resources and your code for the dialog's class in seperate files. For a pure ASP developer, I could see how not being used to this may cause problems.
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
Only the very first application I wrote for ASP .NET did not use a code-behind, and that's because I was writing it in Notepad because Visual Studio .NET had not stabilized yet. After VS .NET was released, I found the code-behind to be very easy to use.