View Single Post
  #2 (permalink)  
Old March 28th, 2012, 02:00 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 71,561, Level: 100
Points: 71,561, Level: 100 Points: 71,561, Level: 100 Points: 71,561, Level: 100
Activity: 80%
Activity: 80% Activity: 80% Activity: 80%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,002
Thanks: 79
Thanked 1,574 Times in 1,551 Posts
Default

Hi Tulsi,

That's one of the problems with web forms and code behind. It could be anything depending on the code you write. If you use

myControl.BackgroundColor = Color.Blue;

it's the presentation layer. If you calculate a discount based on the number of items the customer has in his cart, it's business logic. If you set up a SqlConnection object and access the database, it's the data access layer.

In general, you should strive to write as little code in Code Behind and instead delegate to the appropriate layer. This way, the Code Behind becomes more of an orchestrator / controller as in MVC.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote