ASP.NET - Working with Styles

Styles are used to define a set of formatting options, which can be reused to format different HTML elements on a single or multiple Web pages. Styles can be defined in any of the following ways:
  • Using inline styles
  • Using an embedded style sheet
  • Using an external (linked) style sheet
Using Inline Styles
Inline styles are style definitions that are applied to the style property of a particular HTML element, and are placed directly inside the element on which it has to be implemented. Inline styles are used when one wants to apply one-time formatting to an HTML element.
To use inline styles in a Web page, use the style attribute in the relevant HTML tag. For example, if the text of a paragraph has to be displayed in italicized and Arial font, then the style for the tag will be as shown in the following markup.

ASP.NET - Custom Controls

Custom Controls are controls that are created by combining two or more controls and can be reused in multiple Web applications.
Following types of custom controls can be created:-
  • Web user controls
  • Web custom controls
  • Templated user controls
Web user controls
Web user controls are containers that can be created by combining one or more Web server controls. After creating a Web user control, it can can be treated as a unit and define properties and methods for it. Web user controls are similar to ASP.NET Web pages in the context that they contain both a user interface page and code.

ASP.NET - Web Server Controls

Processing of Server Controls on a Web Page

The processing of a server control depends on two situations, whether the page is requested for the first time by the client or it is posted back to the Web server when the user interacts with the Web page.
When a page is requested for the first time, the server controls are processed in the following sequence:-
  1. Initializing
  2. Loading
  3. PreRendering
  4. Saving
  5. Rendering
  6. Disposing
  7. Unloading
                                          LEARN MORE >>>>

ASP.NET - The Page Class

All Web forms are instances of the ASP.NET Page class, which is defined in the System.Web.UI namespace. The Page class inherits theTemplateControl class, which in turn, inherits the Control class. As a result, the Page class provides useful events that can be used in the code.

Page Events
ASP.NET uses an event-driven model of programming. This model of ASP.NET defines a sequence of events that are raised during the lifecycle of a Web page. Following are some of the page events:
  • Init - It is the first event that occurs when the server executes an ASP.NET page. It occurs only once in the entire lifecycle of an ASP.NET page.
  • Load - It is fired after the Init event, when the page is requested for the first time and whenever the page is reloaded. This page is used to initialize the variables and the state of controls that are used in the page.

ASP.NET Web Page Code Model

A Web page is made up of the following two components:
  1. The Visual portion
  2. The programming logic
ASP.NET provides two models for managing the visual elements and code:
  1. Single-file page model
  2. Code-behind page model
The Single-file Page Model

In the single-file page model, HTML markup of the page and its programming code are in the same physical .aspx file.

Anatomy of an ASP.NET Application

ASP.NET applications are generally divided into multiple Web pages. Every Web page in an ASP.NET application shares a common set of resources and configuration settings.
Each ASP.NET application is executed inside a separate application domain. These application domains ensure that even if a Web application causes a fatal error, it does not affect other applications that are currently running on the same computer.
Each Web application is a separate entity that has its own set of data. It can be described as a combination of files, pages, handlers, modules, and executable code that can be invoked from a virtual directory on a Web server.

Directories Used in ASP.NET Web Applications:
Bin: Stores all the compiled .NET components (DLLs) that an ASP.NET Web application uses.

                     LEARN MORE >>>>

Exploring ASP.NET

ASP.NET is a server-side technology that enables programmers to create dynamic Web applications. It has a number of advanced features such as simplicity, security, and scalability that help s in developing robust Web applications. These advanced features of ASP.NET are based on the .NET Framework.

ASP.NET in the .NET Framework
ASP.NET is built on the Microsoft .NET Framework. Microsoft introduced the .NET Framework to help developers create globally distributed software with Internet functionality and interoperability. 
ASP.NET has the following elements:
  • Web Form Pages
  • Configuration files
  • XML Web Service files
                                          LEARN MORE >>>

Introducing Web Development / ASP.Net

One of the most popular server-side technologies used today for developing Web applications is ASP.NET.
WEB applications are programs that are executed on a Web server and accessed from a Web browser. These applications enable organizations to share and access information on the Internet and corporate intranets.
This information can be accessed from anywhere and at any time. In additions, Web applications can support on-line commercial transactions popularly known as e-commerce. An on-line store accessed through a Web browser is an example of a Web application.
A Web Application consists of Web pages. Web pages can be of the following types:

                          LEARN MORE >>