W e b t u t o r i a l s

Website

Intro to ASP.NET

ASP.NET Web Forms

Standard Controls

Label Control

TextBox Control

Image Control

Button Controls

Redirecting User

Using HyperLinks

RadioButton Control

RadioButtonList

CheckBox Control

CheckBoxList Control

DropDownList

ListBox Control

ImageMap Control

Master Page

View State

Event-Driven Programming

IsPostBack

Structure of an ASP.NET Page

Visibility of Controls

Formatting Controls

Applying CSS

Dynamic CSS

Using Style Class

Themes and Skins

Panel Control

PlaceHolder Control

AdRotator Control

Calendar Control

Validation Controls

Page Navigation

User Control

Separating Code From Presentation

Overview of ADO.NET

Data Binding

Binding Data to a List Control

Separating Code From Presentation

ASP.NET enables you to separate the design content and the application logic of a page into distinct files. This not only makes code maintenance simpler, but it also enables the design team and the coding team to work independently of each other.
There are two ways of separating code from presentation. You can package the application logic in components, or you can use the technique of code-behind. In code-behind, the code is placed in a separate file and the ASP.NET page inherits from this file. It is a feature of ASP.NET and it only enables Visual Studio.NET to separate the application logic from the presentation content.

Components
A component is a VB/CS class file. It can contain one or more VB/CS classes. The file has the extension .vb/.cs. To use the component, you must compile it and save it in the /bin directory of your ASP.NET application.

Advantages of Components
• Components enable you to separate presentation content from application logic. They encapsulate the application logic while the user interface of the page can be designed separately.
• Components enable code reusability. You can create a library of business components and reuse them across multiple ASP.NET pages.
• Components are compiled. They can be distributed safely because the clients cannot see or modify the source code easily.
• Components can be written in multiple languages. Components written in different languages can be combined into a single ASP.NET page.

Example: Building a Component


Using a Component:
Copy the DLL file to the \bin directory of your Web application.
Import the namespace containing the component. You can then instantiate the component and call its methods.

SimpleComponent.aspx


Output