Codebehind beginner dude...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Im start to learning c#.... My question is

I have a webform1.asp

¿What are the difference between write code c# inside the codebehind of the page (webform1.aspx.cs), and write c# code inside the tab "html" page like <script language=c#> (webform.aspx) ......

Thanks a lot

Janderlen
 
=?Utf-8?B?SmFuZGVybGVu?= said:
What are the difference between write code c# inside the codebehind of
the page (webform1.aspx.cs), and write c# code inside the tab "html"
page like <script language=c#> (webform.aspx) ......?

Code behind separates the code so a web artist can change the look without
mucking in the code, and vice versa.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
 
The reason for codebehind files is to seperate the presenetation from the
logic. On a large project you may have some people designing the web pages
(aspx), and other people writing the code. Another lesson from old ASP is
that if you mix code and presentation in the same file, things get really
messy very fast. ASP and ASP.NET are very different so the mixing shoudln't
be as bad as old ASP.

Microsoft uses the same system in Avalon, the new presentation system in
Longhorn. The GUI is stored in XAML files, the code may be stored in
seperate files.

The choice of using seperate code files or emedding it with the presentation
is a matter of personal preference. If you like everything in one place, go
for it, if not, use codebehind files.

Chris

Janderlen said:
Hi,

Im start to learning c#.... My question is:

I have a webform1.aspx

¿What are the difference between write code c# inside the codebehind of
the page (webform1.aspx.cs), and write c# code inside the tab "html" page
 
It's also worth noting on an object orientated angle that your aspx page will inherit it's type from the .cs file.
So what you are basically doing when modifying the .cs is altering the base class of the aspx page.
 
Back
Top