Darren Kopp said:
This is good news.
But I believe their explanation is totally wrong.
I have had the debate (code-inside or Code-inline vs Code-Behind) with many
people in the past and still prefer the one page approach. Apparently, so
does MS since it is now the default model (according to this article). I
have even been told that PROFESSIONAL programmers use code behind, as if
there were no professional programmers before VS.
The error in the article is comparing asp.net code-inside(inline) with asp.
This is absolutely incorrect.
*************************************************************************************************
In ASP.NET 1.x, you could develop an ASP.NET page in one of two ways. First,
you could put your code directly inline with your ASP.NET tags. The code
inline model is very similar to the coding model that was prevalent with
classical ASP and other scripting languages. However, the code inline model
has several problems, such as the intermixing of code and HTML. ASP.NET 1.0
introduced the code-behind model as a replacement. The code-behind model
used an external class to house the code, while the ASPX page contained the
HTML and ASP.NET tags. The code-behind model thus successfully separated
code from content; however, it created some interesting inheritance issues
and forced the developer to keep track of two files for each Web page.
Although ASP.NET 2.0 still supports both of these models, several
significant changes have been made.
********************************************************************************************************
You don't mix the html code and scripting code as you do in asp. You have
complete separation as you do in the Code-Behind. The separation happens by
putting the Script at the top of the page and the HTML at the bottom. (or
you could reverse this, I suppose).
Code Inline
*******************************************************************************************************************
The code inline model is now the default model for Visual Studio 2005. Any
code you add to the page will automatically be added to a <script> block
within the ASPX file instead of to a code-behind class. However, Visual
Studio 2005 still displays the code in the code view. In other words, you
can keep using Visual Studio like you always have, except that code will be
placed directly in the ASPX page instead of a separate class.
******************************************************************************************************************
As they say here (and as I have always said), inline still keeps the
separation. But according to this, VS will create the Script block for
you - which is fine.
This always made more sense than that the 2 file method.
What I am curious about, is whether it will recognise old code not written
in VS and handle it correctly, or is there some hidden code somewhere that
MS uses to navigate the page and site.
I would like to just start using VS2005 on my current site and bring it up
to 2.0, without having to rewrite all my pages to work with the new models
set up by MS. It sounds like this is the case, unless there is some gotcha
that you won't find out about until you try it.
Thanks,
Tom