473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Codebehind beginner dude...

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
Nov 16 '05 #1
3 1226
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" <an*******@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
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
like <script language=c#> (webform.aspx) ......?
Thanks a lot.

Janderlen

Nov 16 '05 #2
=?Utf-8?B?SmFuZGVybGVu?= <an*******@discussions.microsoft.com> wrote in
news:D8**********************************@microsof t.com:
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/
Nov 16 '05 #3
Jax
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.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
8
by: Krunom Ancini | last post by:
Hi, im just the beginner and im using c#-codebehind in my asp.net-application.... What should i do to make my application work "without" code-behind (without dll.-s in bin-folder)? I was...
12
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that...
12
by: A.M | last post by:
Hi, Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i still have intelisence and generally IDE support for that? Thanks, Ali
3
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to...
5
by: Dude | last post by:
I migrated to 1.1 Changes I make to the aspx page are fine, changes to codebehind page are not reflected after I compile and view in the browser. I deleted all the files from the cache directory on...
0
by: Antoine | last post by:
Forgive me as a beginner in asp.net. I wanted to ask some simple but clear questions, at least I hope they are. Ive seen a control in asp.net that works with codebehind and the good thing about...
15
by: RAM | last post by:
Hello, I graduated computer science faculty and decided to became a programmer. Please help me to make a decision: Java or Microsoft .NET? What is the future of Java? Thanks! /RAM/
15
by: Mahernoz | last post by:
Hi Friends, I simply want to print a report by opening a popup, calling the print function and closing the window after the user has printed the report. I have 2 functions.... in c# The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.