codefile vs codebehind in ASP.NET 2.0

G

Guest

Can anyone @ MS help us understand why this change was made?
What value does it add?

(It just seems like an unnecessary semantic change to me)

Thanks!
 
K

Karl Seguin

You are likely not to hear anything official from MS here about the
topic...you should take a look at:
http://pluralsight.com/blogs/fritz/archive/2005/01/18/5111.aspx

many people don't like it, many people think the beta 2 change is better
than what was in beta 1...some thing it's worse and they should have stuck
to the old model....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
J

Juan T. Llibre

I think it was necessary to accomodate the
changes which partial classes imply.

If you continue to use codebehind,
1.1-type source compilation will be implemented.

If you use codefile, you can take advantage of partial classes.
 
T

Teemu Keiski

You don't have compile code-beside class manually as you had to with in v1.1
with VS.NET 2003 & code-behind class (worked in v1.1 with using Src
attribute in Page directive instead of VS's default Inherits). You make c
ahnge to the class, and the change is reflected automatically.

Another thing being that in old model dynamically generated class derived
from the code-behind class, but with the new model they are one and the same
class. This means that you don't have to have separate declarations for
code-behind members (controls) like with the old model. Also because it is
now only one class, private members are visible from dynamically generated
class to code-beside and vice versa.

There are also pre-compilation features and a few other things that are of
interest.

Have you seen these articles for the idea of this new model?

ASP.NET 2.0 Internals
http://msdn.microsoft.com/asp.net/whidbey/default.aspx?pull=/library/en-us/dnvs05/html/internals.asp

Update on changes for Beta 2
http://msdn.microsoft.com/asp.net/whidbey/beta2update.aspx
 
G

Guest

Teemu said:
You don't have compile code-beside class manually as you had to with in v1.1
with VS.NET 2003 & code-behind class (worked in v1.1 with using Src
attribute in Page directive instead of VS's default Inherits). You make c
ahnge to the class, and the change is reflected automatically.

Another thing being that in old model dynamically generated class derived
from the code-behind class, but with the new model they are one and the same
class. This means that you don't have to have separate declarations for
code-behind members (controls) like with the old model. Also because it is
now only one class, private members are visible from dynamically generated
class to code-beside and vice versa.

There are also pre-compilation features and a few other things that are of
interest.

Have you seen these articles for the idea of this new model?

ASP.NET 2.0 Internals
http://msdn.microsoft.com/asp.net/whidbey/default.aspx?pull=/library/en-us/dnvs05/html/internals.asp

Update on changes for Beta 2
http://msdn.microsoft.com/asp.net/whidbey/beta2update.aspx


You still have a code behind file for the page, it's just a partial
class now. Could they have not just left it alone and figured out
which style v1.x or 2.0 the code was using by the presence of the class
being declared as partial??
 
T

Teemu Keiski

see below,

You still have a code behind file for the page, it's just a partial
class now. Could they have not just left it alone and figured out
which style v1.x or 2.0 the code was using by the presence of the class
being declared as partial??

Well, there's still the good part like no need to declare members in the
code file. :) I think following post at ASP.NET Forums covers the reasoning
quite well, see especially Scott Guthrie's comments.
http://forums.asp.net/765218/ShowPost.aspx
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top