Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

TOPIC: ASP .

NET

GROUP:06

MEMBERS
SUNMITTED TO:
ABDULLA AL MAMUN 1306001
PRODIP KUMAR SARKAR
AZAD HOSSAIN -1306003
ASSISTANT PROFESSOR
UJJAL KUMAR ROY -1306004 DEPT. OF COMPUTER SCIENCE &
ENGINEERING
ABDULLA AL KAFI – 1306005
BEGUM ROKEYA
KASHI NATH BARMON -1306016
UNIVERSITY,RANGPUR
GOPAL CHANDRO ROY SWAPON -
1306040
ASP.NET Programming model

1. INTRODUCTION
ASP.NET is a Web development platform that provides services, a programming model, and
software infrastructure necessary to build enterprise-class applications. Although largely syntax
compatible with its popular predecessor Active Server Pages (ASP) ASP.NET is a revolutionary
new programming framework designed to enable the rapid development of Web applications. As
part of the Microsoft .NET platform, ASP.NET provides a component-based, extensible, and
easy-to-use way to build, deploy, and run Web applications that target any browser or mobile
device.

2. WHAT IS ASP.NET?

Like ASP and other Web development environments, ASP.NET also works on top of the HTTP
protocol and takes advantage of HTTP commands and policies to set up two-way, browser-to-
server communication and cooperation. What really differentiates ASP.NET from the plethora of
other Web development technologies is the abstract programming model it propounds, the Web
Forms model. In addition, the whole ASP.NET platform comes as a native part of the
Microsoft .NET Framework. To be sure you grasp the importance of this last point, let me
explain. ASP.NET applications are compiled pieces of code, are made of reusable and extensible
components, can be authored with first class languages (including C#, Microsoft Visual Basic
.NET, Microsoft JScript .NET, and J#), and can access the entire hierarchy of classes in the
.NET Framework.

In short, ASP.NET combines the best of all worlds. It is semantically compatible (and, to some
extent, also language compatible) with ASP. It provides the same object oriented features as JSP
applications (tag customization, compiled languages, components, extensibility, and reusability).
And as icing on the cake, ASP.NET delivers a wealth of goodies, tools, and powerful system
features that can be effectively grouped within the blanket expression tools for abstracting the
HTTP programming model. Lots of programmer-friendly classes let you develop pages using
typical desktop methods. The Web Forms model promotes an overall event-driven approach, but
it is deployed over the Web.

2.1 Programming in the Age of Web Forms


The rationale behind the ASP.NET Web Forms model is directly related to the search for a better
strategy to deal with the growing demand for cheap but powerful Web interaction. As a matter of
fact, the HTTP protocol represents the major strength and weakness of Web applications.

2.2 Event-Driven Programming over HTTP

ASP.NET Web Forms bring the event-driven model of interaction to the Web. Implementing an
event model over the Web requires any data related to the client-side user’s activity to be
forwarded to the server for corresponding and stateful processing. The server processes the
output of client actions and triggers reactions.

2.3 Structure of an ASP.NET Page

An ASP.NET page is a server-side text file saved with the .aspx extension. The internal structure
of the page is extremely modular and comprises three distinct sections page directives, code, and
page layout:

 Page directives. Page directives set up the environment in which the page will run,
specify how the HTTP runtime should process the page, and determine which
assumptions about the page are safe to make. Directives also let you import namespaces
to simplify coding, load assemblies not currently in the global assembly cache (GAC),
and register new controls with custom tag names and namespace prefixes.

 Code section. The code section contains handlers for page and control events, plus
optional helper routines. Any source code pertinent to the page can be inserted inline or
attached to the page through a separate file.

 Page layout. The page layout represents the skeleton of the page. It includes server
controls, literal text, and HTML tags. The user interface of the server controls can be
fleshed out a bit using declared attributes and control properties.

3. The ASP.NET Component Model

ASP.NET is the key enabling technology for all Web-related functionality provided by the .NET
Framework. The .NET Framework is made entirely of an object-oriented hierarchy of classes
that span all programming topics for Windows operating systems.
The ASP.NET runtime transforms the source code of the requested .aspx page into the living
instance of a .NET Framework class that inherits from a base class named Page. At the end of
the day, a running ASP.NET page is an object, and so it is for some of its components the server-
side controls.

3.1 A Model for Component Interaction

Any element in an ASP.NET page that is marked with the runat attribute can be given a unique
ID, allowing you to access that element from your server-side code. Accessing items by ID is a
natural approach on the client (such as the use of Dynamic HTML pages), but it represents a
brand new scheme for server applications. Two factors make this revolutionary approach
possible:

 The component-based architecture of the .NET platform, and the fact that ASP.NET is a
constituent part of that platform.

 The ASP.NET built-in mechanism for the application’s state management.

3.2 The runat Attribute

The runat attribute is what determines whether a piece of markup text is to be emitted verbatim
at render time or transformed into a stateful instance of a particular .NET class. In the latter case,
the class would make itself responsible for emitting the related markup. In an ASP.NET page, all
markup elements that have the runat attribute set to server are considered server-side controls.
The control class exposes methods and properties that let you configure the state of the
component. The control is responsible for emitting HTML code when the page is rendered to the
browser.

3.3 ASP.NET Server Controls

There are basically two families of ASP.NET server controls. They are HTML server controls
and Web server controls. System.Web.UI.HtmlControls is the namespace of HTML server
controls. System.Web.UI.WebControls groups all the Web server controls.

3.3.1 HTML Server Controls


HTML server controls are classes that represent a standard HTML tag supported by most
browsers. The set of properties of an HTML server control matches a commonly used set of
attributes of the corresponding tag. The control feature properties such as InnerText, InnerHtml,
Style, and Value plus collections such as Attributes. Instances of HTML server controls are
automatically created by the ASP.NET runtime each time the corresponding HTML tag marked
with runat="server" is found in the page source.
3.3.2 Web Server Controls
Web server controls are controls with more features than HTML server controls. Web server
controls include not only input controls such as buttons and text boxes, but also special-purpose
controls such as a calendar, an ad rotator, a drop-down list, a tree view, and a data grid. Web
server controls also include components that closely resemble some HTML server controls. Web
server controls, though, are more abstract than the corresponding HTML server controls in that
their object model doesn’t necessarily reflect the HTML syntax.

4. The ASP.NET Development Stack

At the highest level of abstraction, the development of an ASP.NET application passes through
two phases—pages authoring and run-time configuration. You build the pages that form the
application, implement its user’s requirements, and then fine-tune the surrounding run-time
environment to make it serve pages effectively and securely. Let’s examine the various logical
layers to see what they contain and why they contain it.

4.1The Presentation Layer

An ASP.NET page is made of controls, free text, and markup. When the source code is
transformed into a living instance of a page class, the ASP.NET runtime makes no further
distinction between verbatim text, markup, and server controls everything is a control, including
literal text and carriage-return characters. At run time, any ASP.NET page is a mere graph of
controls.

4.2The Page Framework


Any ASP.NET page works as an instance of a class that descends from the Page class. The
Page class is the ending point of a pipeline of modules that process any HTTP request. The
various system components that work on the original request build step by step all the
information needed to locate the page object to generate the markup. The page object model
sports several features and capabilities that could be grouped in terms of events, scripting,
personalization, styling, and prototyping.

4.3 The HTTP Runtime Environment

The process model is the sequence of operations needed to process a request. When theASP.NET
runtime runs on top of IIS 5.x, the process model is based on a separate worker process named
aspnet_wp.exe. This Microsoft Win32 process receives control directly from IIS through the
hosted ASP.NET ISAPI extension. The extension is passed any request for ASP.NET resources,
and it hands them over to the worker process.
The worker process loads the common language runtime (CLR) and starts the pipeline of
managed objects that transform the original request from an HTTP payload into a full featured
page for the browser. The aspnet_isapi module and the worker process implement advanced
features such as process recycling, page output caching, memory monitoring, and thread pooling.
Each Web application runs in a distinct App Domain within the worker process. By default, the
worker process runs under a restricted, poorly privileged account named ASPNET.

5. The ASP.NET Provider Model

There’s a well-known design pattern behind the ASP.NET provider model the strategy pattern.

The most notable feature of the strategy pattern is that it provides a way for an object, or an
entire subsystem, to expose its internals so that a client can unplug the default implementation of
a given feature and plug his own in. This is exactly what happens in ASP.NET for a number of
services, including membership, roles, state management, personalization, site navigation. The
ASP.NET provider model is the ASP.NET implementation of the strategy pattern.

5.1 The Rationale Behind the Provider Model

The provider model is not an application feature that end users can see with their own eyes. In
itself, it doesn’t make an application show a richer content, run faster, or be more responsive.

The provider model is an infrastructural feature that improves an application’s architecture by


enabling developers and architects to operate under the hood of some system components. At the
same time, it enables developers to build new components that expose hooks for clients to plug
in and customize behavior and settings. Implementing the strategy pattern doesn’t transform an
application into an open-source project, allowing anybody to modify anything. It simply means
that you have a simple, elegant, and effective pattern to make certain parts of your application
customizable by clients.

5.2 A Quick Look at the ASP.NET Implementation


The implementation of the ASP.NET provider model consists of three distinct elements the
provider class, configuration layer, and storage layer.

 The provider class is the component you plug into the existing framework to provide a
desired functionality the way you want.

 The configuration layer supplies information used to identify and instantiate the actual
provider.

 The storage layer is the physical medium where data is stored. Depending on the feature,
it can be Active Directory, an Oracle or SQL Server table, an XML file, or whatever else.
Anatomy of ASP.Net

ASP.NET pages are dynamically compiled on demand when first required in the context of a
Web application. Dynamic compilation is not specific to ASP.NET pages alone (.aspx files); it
also occurs with .NET Web Services (.asmx files), Web user controls (.ascx files), HTTP
handlers (.ashx files), and a few more ASP.NET application files such as the global.asax file. A
pipeline of run-time modules takes care of the incoming HTTP packet and makes it evolve from
a simple protocol-specific payload up to the rank of a server-side ASP.NET object—precisely,
an instance of a class derived from the system’s Page class.

Here we’ll review how an HTTP request for an .aspx resource is mapped to a page object, the
programming interface of the Page class, and how to control the generation of the markup by
handling events of the page life cycle.

Invoking a Page
Roughly speaking, an ASP.NET page contains Markup(appears in the .aspx page) and Server-side code
that the ASP.NET worker executes(appears in the .aspx page or in a separate code behind page). Now we
talk how the .aspx page is converted into a class and then compiled into an assembly. Generating an
assembly for a particular .aspx resource is a two-step process:

Firstly, the source code of the resource file is parsed and a corresponding class is created that inherits
either from Page or another class that, in turn, inherits from Page.

Second, the dynamically generated class is compiled into an assembly and cached in an ASP.NET-
specific temporary directory.

IIS 5.0 Process Model


The IIS 5.0 process model is the only option you have if you host your ASP.NET application on any
version of Microsoft Windows prior to Windows 2003 Server. According to this processing model,
aspnet_isapi.dll doesn’t process the .aspx file, but instead acts as a dispatche.

It collects all the information available about the invoked URL and the underlying resource, and then it
routes the request toward another distinct process—the ASP.NET worker process named aspnet_wp.exe.
The communication between the ISAPI extension and worker process takes place through named pipes. A
single copy of the worker process runs all the time and hosts all the active Web applications. The only
exception to this situation is when you have a Web server with multiple CPUs. In this case, you can
configure the ASP.NET runtime so that multiple worker processes run, one per each available CPU.

When a single worker process is used by all CPUs and controls all Web applications, it doesn’t
necessarily mean that no process isolation is achieved. Each Web application is, in fact, identified with its
virtual directory and belongs to a distinct application domain, commonly referred to as an AppDomain. A
new AppDomain is created within the ASP.NET worker process whenever a client addresses a virtual
directory for the first time.

Figure: The ASP.NET runtime environment according to the IIS 5.0 process model

IIS 6.0 Process Model


Be aware that switching back to the old IIS 5.0 process model is not a recommended practice, although it
is perfectly legal. The main reason lies in the fact that IIS 6.0 employs a different pipeline of internal
modules to process an inbound request and can mimic the behavior of IIS 5.0 only if running in emulation
mode. The IIS 6.0 pipeline is centered around a generic worker process named w3wp.exe. A copy of this
executable is shared by all Web applications assigned to the same application pool. In the IIS 6.0 jargon,
an application pool is a group of Web applications that share the same copy of the worker process. Three
are different reason IIS6.0 process model better than IIS5.0 process model. These are given below:

 IIS 6.0 implements its HTTP listener as a kernel-level module. As a result, all incoming requests
are first managed by such a driver—http.sys—and in kernel mode. No thirdparty code ever
interacts with the listener, and no user-mode crashes will ever affect the stability of IIS.
 In the IIS 6.0 process model, ASP.NET runs even faster because no interprocess communication
between inetinfo.exe (the IIS executable) and the worker process is required. The HTTP request
is delivered directly at the worker process that hosts the CLR. Furthermore, the ASP.NET worker
process is not a special process but simply a copy of the IIS worker process.

Figure: How ASP.NET and Web applications are processed in IIS 6.0.

IIS File Mapping

i. .asax ASP.NET application files. The typical example isglobal.asax.


ii. .aspx Files that represent ASP.NET pages.
iii. .ascx ASP.NET user control files.
iv. .asmx Files that implement .NET Web services.
v. ashx HTTP handlers.

ASP.NET - Life Cycle


ASP.NET life cycle specifies generally these format:

 ASP.NET processes pages to produce dynamic output


 application and its pages are instantiated and processed
 ASP.NET compiles the pages dynamically

The ASP.NET life cycle could be divided into two groups.

 Application Life Cycle


 Page Life Cycle

ASP.NET Application Life Cycle


The application life cycle has the following stages:
 User makes a request for accessing application resource, a page. Browser sends this
request to the web server.
 A unified pipeline receives the first request and the following events take place:
o An object of the class Application Manager is created.
o An object of the class Hosting Environment is created to provide information
regarding the resources.
o Top level items in the application are compiled.
 Response objects are created. The application objects such as Http Context, Http Request
and Http Response are created and initialized.
 An instance of the Http Application object is created and assigned to the request.
 The request is processed by the Http Application class. Different events are raised by this
class for processing the request.

ASP.NET Page Life Cycle

When a page is requested, it is loaded into the server memory, processed, and sent to the
browser. Then it is unloaded from the memory. At each of these steps, methods and events are
available, which could be overridden according to the need of the application. In other words,
you can write your own code to override the default code.
The Page class creates a hierarchical tree of all the controls on the page. All the components on
the page, except the directives, are part of this control tree. You can see the control tree by
adding trace= "true" to the page directive. We will cover page directives and tracing under
'directives' and 'event handling'.
The page life cycle phases are:

 Initialization
 Instantiation of the controls on the page
 Restoration and maintenance of the state
 Execution of the event handler codes
 Page rendering
Understanding the page cycle helps in writing codes for making some specific thing happen at
any stage of the page life cycle. It also helps in writing custom controls and initializing them at
right time, populate their properties with view-state data and run control behavior code.
Following are the different stages of an ASP.NET page:
 Page request - When ASP.NET gets a page request, it decides whether to parse and
compile the page, or there would be a cached version of the page; accordingly the
response is sent.
 Starting of page life cycle - At this stage, the Request and Response objects are set. If
the request is an old request or post back, the Is PostBack property of the page is set to
true. The UICulture property of the page is also set.
 Page initialization - At this stage, the controls on the page are assigned unique ID by
setting the UniqueID property and the themes are applied. For a new request, Postback
data is loaded and the control properties are restored to the view-state values.
 Page load - At this stage, control properties are set using the view state and control state
values.
 Validation - Validate method of the validation control is called and on its successful
execution, the Is Valid property of the page is set to true.
 Postback event handling - If the request is a postback (old request), the related event
handler is invoked.
 Page rendering - At this stage, view state for the page and all controls are saved. The
page calls the Render method for each control and the output of rendering is written to
the Output Stream class of the Response property of page.
 Unload - The rendered page is sent to the client and page properties, such as Response
and Request, are unloaded and all cleanup done.

ASP.NET Page Life Cycle Events

At each stage of the page life cycle, the page raises some events, which could be coded. An
event handler is basically a function or subroutine, bound to the event, using declarative
attributes such as Onclick or handle.
Following are the page life cycle events:
 PreInit - PreInit is the first event in page life cycle. It checks the IsPostBack property
and determines whether the page is a postback. It sets the themes and master pages,
creates dynamic controls, and gets and sets profile property values. This event can be
handled by overloading the OnPreInit method or creating a Page_PreInit handler.
 Init - Init event initializes the control property and the control tree is built. This event
can be handled by overloading the OnInit method or creating a Page_Init handler.
 InitComplete - InitComplete event allows tracking of view state. All the controls turn on
view-state tracking.
 LoadViewState - LoadViewState event allows loading view state information into the
controls.
 LoadPostData - During this phase, the contents of all the input fields are defined with
the <form> tag are processed.
 PreLoad - PreLoad occurs before the post back data is loaded in the controls. This event
can be handled by overloading the On PreLoad method or creating a Page PreLoad
handler.
 Load - The Load event is raised for the page first and then recursively for all child
controls. The controls in the control tree are created. This event can be handled by
overloading the OnLoad method or creating a Page_Load handler.
 LoadComplete - The loading process is completed, control event handlers are run, and
page validation takes place. This event can be handled by overloading the On Load
Complete method or creating a Page Load Complete handler
 PreRender - The PreRender event occurs just before the output is rendered. By handling
this event, pages and controls can perform any updates before the output is rendered.
 PreRenderComplete - As the PreRender event is recursively fired for all child controls,
this event ensures the completion of the pre-rendering phase.
 SaveStateComplete - State of control on the page is saved. Personalization, control state
and view state information is saved. The HTML markup is generated. This stage can be
handled by overriding the Render method or creating a Page_Render handler.
 UnLoad - The UnLoad phase is the last phase of the page life cycle. It raises the UnLoad
event for all controls recursively and lastly for the page itself. Final cleanup is done and
all resources and references, such as database connections, are freed. This event can be
handled by modifying the OnUnLoad method or creating a Page UnLoad handler.

An ASP.NET page is made up of a number of server controls along with HTML controls, text,
and images. Sensitive data from the page and the states of different controls on the page are
stored in hidden fields that form the context of that page request. ASP.NET runtime controls the
association between a page instance and its state. An ASP.NET page is an object of the Page or
inherited from it. All the controls on the pages are also objects of the related control class
inherited from a parent Control class. When a page is run, an instance of the object page is
created along with all its content controls.
An ASP.NET page is also a server side file saved with the .aspx extension. It is modular in
nature and can be divided into the following core sections:

 Page Directives
 Code Section
 Page Layout

The Processing Directives of a Page

The page directives set up the environment for the page to run. The @Page directive defines
page-specific attributes used by ASP.NET page parser and compiler. Page directives specify how
the page should be processed, and which assumptions need to be taken about the page.
It allows importing namespaces, loading assemblies, and registering new controls with custom
tag names and namespace prefixes.

The Application Directive

The Application directive defines application-specific attributes. It is provided at the top of the
global.aspx file. The basic syntax of Application directive is:
<%@ Application Language="C#" %>
The attributes of the Application directive are:

Attributes Description

Inherits The name of the class from which to inherit.

Description The text description of the application. Parsers and


compilers ignore this.

Language The language used in code blocks

The Assembly Directive

The Assembly directive links an assembly to the page or the application at parse time. This
could appear either in the global.asax file for application-wide linking, in the page file, a user
control file for linking to a page or user control. The basic syntax of Assembly directive is:
<%@ Assembly Name ="myassembly" %>

The attributes of the Control directive are:

Attributes Description

Name The name of the assembly to be linked.

Source The path to the source file to be linked and


compiled dynamically.

The Control Directive

The control directive is used with the user controls and appears in the user control (.ascx) files.
The basic syntax of Control directive is:
<%@ Control Language="C#" EnableViewState="false" %>
The attributes of the Control directive are:

Attributes Description

AutoEventWireup The Boolean value that enables or disables


automatic association of events to handlers.

ClassName The file name for the control.

Debug The Boolean value that enables or disables


compiling with debug symbols.

Description The text description of the control page, ignored


by compiler.

EnableViewState The Boolean value that indicates whether view


state is maintained across page requests.

Explicit For VB language, tells the compiler to use option


explicit mode.

Inherits The class from which the control page inherits.

Language The language for code and script.

Source The filename for the code-behind class.

Strict For VB language, tells the compiler to use the


option strict mode.

The Implements Directive

The Implement directive indicates that the web page, master page or user control page must
implement the specified .Net framework interface. The basic syntax for implements directive is:
<%@ Implements Interface="interface_name" %>

The Import Directive


The Import directive imports a namespace into a web page, user control page of application. If
the Import directive is specified in the global.asax file, then it is applied to the entire
application. If it is in a page of user control page, then it is applied to that page or control. The
basic syntax for import directive is:
<%@ namespace="System.Drawing" %>

The Master Directive

The Master directive specifies a page file as being the mater page. The basic syntax of sample
MasterPage directive is:

<%@ MasterPage Language="C#" AutoEventWireup="true" CodeFile="SiteMater.master.cs"


Inherits="SiteMaster" %>

The MasterType Directive

The MasterType directive assigns a class name to the Master property of a page, to make it
strongly typed. The basic syntax of MasterType directive is:
<%@ MasterType attribute="value"[attribute="value" ...] %>

The OutputCache Directive

The OutputCache directive controls the output caching policies of a web page or a user control.
The basic syntax of OutputCache directive is:
<%@ OutputCache Duration="15" VaryByParam="None" %>

The Page Directive

The Page directive defines the attributes specific to the page file for the page parser and the
compiler.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" Trace="true" %>
The basic syntax of Page directive is:

Attributes Description
AutoEventWireup The Boolean value that enables or disables
page events that are being automatically bound
to methods; for example, Page_Load.

Buffer The Boolean value that enables or disables


HTTP response buffering.

Class Name The class name for the page

Client Target The browser for which the server controls


should render content.

Code File The name of the code behind file.

Debug The Boolean value that enables or disables


compilation with debug symbols.

Description The text description of the page, ignored by


the parser.

EnableSessionState It enables, disables, or makes session state


read-only.

ErrorPage URL for redirection if an unhandled page


exception occurs.

EnableViewState The Boolean value that enables or disables


view state across page requests.

Inherits The name of the code behind or other class

Language The programming language for code.

Source The file name of the code behind class.

Trace It enables or disables tracing.

TraceMode It indicates how trace messages are displayed,


and sorted by time or category.

Transaction It indicates if transactions are supported.

ValidateRequest The Boolean value that indicates whether all


input data is validated against a hardcoded list
of values.
The PreviousPageType Directive

The PreviousPageType directive assigns a class to a page, so that the page is strongly typed.
The basic syntax for a sample PreviousPagetype directive is:
<%@ PreviousPageType attribute="value"[attribute="value" ...] %>

The Reference Directive

The Reference directive indicates that another page or user control should be compiled and
linked to the current page. The basic syntax of Reference directive is:
<%@ Reference Page ="somepage.aspx" %>

The Register Directive

The Register derivative is used for registering the custom server controls and user controls.
The basic syntax of Register directive is:
<%@ Register Src="~/footer.ascx" TagName="footer" TagPrefix="Tfooter" %>

The Page Class


In the .NET Framework, the Page class provides the basic behavior for all objects that an
ASP.NET application builds by starting from .aspx files. Defined in the 24/47 System.Web.UI
namespace, the class derives from TemplateControl and implements the IHttpHandler interface:
public class Page : TemplateControl, IHttpHandler.

In particular, Template Control is the abstract class that provides both ASP.NET pages and user
controls with a base set of functionality. At the upper level of the hierarchy, we find the Control
class.
The Page class also implements the methods of the IHttpHandler interface, thus qualifying as the
handler of a particular type of HTTP requests—those for .aspx files. The key element of the
IHttpHandler interface is the ProcessRequest method, which is the method the ASP.NET
runtime calls to start the page processing that will actually serve the request.
Properties of Page Class
The properties of the Page object can be classified in three distinct groups:
 Intrinsic objects properties
 Worker properties
 Page-specific properties
Methods of Page Class
The whole range of Page methods can be classified in a few categories based on the tasks each
method accomplishes.
Firstly, A few methods are involved with the generation of the markup for the page. It’s Called
Rendering Methods.
Secondly, others are helper methods to build the page and manage the 30/47 constituent
controls. It’s Called Controls-Related Methods.
Finally, a third group collects all the methods that have to do with client-side scripting. It’s
called Script-Related Methods.

Conclusion

ASP.NET is a complex technology built on top of a substantially simple and, fortunately, solid
and stable Web infrastructure. To provide a highly improved performance and richer
programming toolset, ASP.NET builds a desktop-like abstraction model, but it still has to rely on
HTTP and HTML to hit the target and meet end-user expectations.

In this Section we mentioned controls several times. Server controls are components that get input from
the user, process the input, and output a response as HTML. In the 46/47 next chapter, we’ll explore
various server controls, which include Web controls, HTML controls, and validation controls.

Server Controls

Controls are small building blocks of the graphical user interface, which include text boxes,
buttons, check boxes, list boxes, labels, and numerous other tools. Using these tools, the users
can enter data, make selections and indicate their preferences.
Controls are also used for structural jobs, like validation, data access, security, creating master
pages, and data manipulation.
ASP.NET uses five types of web controls, which are:

 HTML controls
 HTML Server controls
 ASP.NET Server controls
 ASP.NET Ajax Server controls
 User controls and custom controls
ASP.NET server controls are the primary controls used in ASP.NET. These controls can be
grouped into the following categories:
 Validation controls - These are used to validate user input and they work by running
client-side script. Validation are necessary to get the correct data as input and for
security. Validation controls provide an easy-to-use mechanism to perform a variety of
validation tasks, including testing for valid types, values within a given range, or
required fields.
 Data source controls - These controls provides data binding to different data sources.
 Data view controls - These are various lists and tables, which can bind to data from data
sources for displaying.
 Personalization controls - These are used for personalization of a page according to the
user preferences, based on user information.
 Login and security controls - These controls provide user authentication.
 Master pages - These controls provide consistent layout and interface throughout the
application.
 Navigation controls - These controls help in navigation. For example, menus, tree view
etc.
 Rich controls - These controls implement special features. For example, AdRotator,
FileUpload, and Calendar control.

Properties of the Server Controls


ASP.NET server controls with a visual aspect are derived from the web control and inherit all
the properties, events, and methods of this class.
The following table shows some of the properties associated to all server controls:
Property Description

Attributes It is the collection of arbitrary attributes (for rendering only) that do not
correspond to properties on the control.

BackColor Background color.

BindingContainer The control that contains this control's data binding.

BorderColor Border color.

BorderStyle Border style.

BorderWidth Border width.

CausesValidation Indicates if it causes validation.

ClientID Control ID for HTML markup.


Context The HttpContext object associated with the server control.

Controls Collection of all controls contained within the control.

CssClass CSS class

DesignMode It indicates whether the control is being used on a design surface.

Enabled Indicates whether the control is grayed out.

Events Gets a list of event handler delegates for the control.

Forecolor Foreground color.

ID Identifier for the control.

IsEnabled Gets a value indicating whether the control is enabled.

Parent Parent control.

Style Gets a collection of text attributes that will be rendered as a style attribute on
the outer tag of the Web server control.

ToolTip Gets or sets the text displayed when the mouse pointer hovers over the web
server control.

UniqueID Unique identifier.

Visible It indicates whether a server control is visible.

Events of Server Controls


Events are certain actions inside the system that a user can be interested in.

Event Description

DataBinding Occurs when the DataBind method is called on a control and the control is binding to
a data source.
Disposed Occurs when a control is released from memory—the last stage in the control life
cycle.
Init Occurs when the control is initialized—the first step in the life cycle.

Load Occurs when the control is loaded into the page. Occurs after Init.

PreRender Occurs when the control is about to render its content.

Unload Occurs when the control is unloaded from memory.

All server controls are rendered to HTML using the RenderControl method and,


when this happens, the PreRender event is fired.

ADO.NET

ADO.NET is the data-access framework for .NET Framework. ADO stands for ActiveX Data
Object. ADO was a separate library for .net in the early days. But ADO.NET is different from it
and but ADO’s influence exits in it. To be precise, ADO.NET is the alternative to ADO in now a
days.

ADO.NET stands in between the actual data source and the application code. Through
ADO.NET, it is easy to access data sources like SQL Server, MySQL, Oracle etc, from inside
a .net backed project code base. ADO.NET separates data access from data manipulation into
discrete components that can be used separate. ADO.NET includes .NET Framework data
providers for connecting to a database, executing commands, and retrieving results.

ADO.NET has two main components for connecting, accessing and mutating data in data source.
One of the components is Data Provider and the other is Data Container. We will discuss both of
them briefly.

ADO.NET Data Providers

ADO.NET has some managed data provider which enables users to connect, modify and modify
data in data sources.
Principal Components of a .NET Data Provider:

Figure 1 Principal Components of Data Provider

 Connection - Creates a connection with the specified data source, including Microsoft
SQL Server, Oracle, and any data source for which you can indicate either an OLE DB
provider or an ODBC driver.
 Transaction - Represents a transaction to be made in the source database server.
 Command - Represents a command that hits the underlying database server.
 Parameter - Represents a parameter you can pass to the command object.
 DataAdapter - Represents a database command that executes on the specified database
server and returns a disconnected set of records.
 CommandBuilder - Represents a helper object that automatically generates commands
and parameters for a DataAdapter.
 DataReader - Represents a read-only, forward-only cursor created on the underlying
database server.
These are some of the Data Providers that included in the .NET Framework:

.NET Framework data Description


provider
.NET Framework Provides data access for Microsoft SQL Server. Uses
Data Provider for the System.Data.SqlClient namespace.
SQL Server
.NET Framework For data sources exposed by using OLE DB. Uses
Data Provider for the System.Data.OleDb namespace.
OLE DB

.NET Framework For data sources exposed by using ODBC. Uses


Data Provider for the System.Data.Odbc namespace.
ODBC

.NET Framework For Oracle data sources. The .NET Framework Data Provider for
Data Provider for Oracle supports Oracle client software version 8.1.7 and later, and
Oracle uses the System.Data.OracleClient namespace.

EntityClient Provider Provides data access for Entity Data Model (EDM) applications.
Uses the System.Data.EntityClient namespace.

.NET Framework Provides data access for Microsoft SQL Server Compact 4.0. Uses
Data Provider for the System.Data.SqlServerCe namespace.
SQL Server Compact
4.0.

Connecting to Data Sources


To connect to a data source through ADO.NET we have to follow some standard sequential
steps. These steps are data source independent. There are some classes inside ADO.NET for this
purpose and if we provide data source url, username, password and which kind of data source we
are trying to connect then it will handle the rest by itself and we don’t have to worry about it.

After connecting we can prepare and execute commands or statements to retrieve or manipulate
data inside the data source independent of the data source.

Data Provider also provides mechanism for transaction management, roll back etc.

ADO.NET Data Container

ADO.NET Data Containers are in-memory counterpart of various database (data source)
constructs like table, view etc. They live in memory and once populated with data to contain
those data become completely decoupled from the corresponding data source (database). The
containers are DataSet, DataTable, DataView, DataRelation.
The dataset is a disconnected, in-memory representation of data. It can be considered as a local
copy of the relevant portions of the database. The DataSet is persisted in memory and the data in
it can be manipulated and updated independent of the database. When the use of this DataSet is
finished, changes can be made back to the central database for updating.

Others have self-explanatory names and they work in that way. But there is a middle-man here
too who works as a bridge between the data source and the in-memory objects, The Data
Adapter. Data Adapter adapts the retrieved data to the in-memory objects like DataSet or
DataTable. It handles the type conversion of data fields from data source types to the .NET
types. As DataSet or Data Table is disconnected container of data, and the adapter takes care of
filling it and submitting its data back to a particular data source.

The big difference between commands and data adapters is just in the way each one returns the
retrieved data. A query command returns a read-only, forward-only cursor the data reader.

DATA-BINDING MODEL

The data-binding model of ASP.NET is founded on three pillars: data-binding expressions,


classic data source–based binding, and data source controls, which are limited to ASP.NET 2.0.

Data Source–Based Data Binding:


Data binding is the process that retrieves data from a fixed source and dynamically associates
this data to properties on server controls

ADO.NET Classes
ADO.NET provides a bunch of data container classes that can be filled with any sort of data,
including results of a database query.

Collection-Based Classes

All collection classes implement the ICollection interface, which in turn implements the
IEnumerable interface. As a result, all collection classes provide a basic set of functionalities.

IList and IDictionary are two interfaces that extend ICollection, giving a more precise
characterization to the resultant collection class. ICollection provides only basic and minimal
functionality for a collection.
IList and IDictionary are two interfaces that extend ICollection, giving a more precise
characterization to the resultant collection class. ICollection provides only basic and minimal
functionality for a collection. Commonly used container classes that implement both ICollection
and IList are Array, ArrayList, and StringCollection. The IDictionary interface defines the API
that represents a collection of key/value pairs.

Data-Binding Properties:

The DataSource Property

The DataSource property lets you specify the data source object the control is linked to.

public virtual object DataSource {get; set;}

The DataSourceID Property

public virtual string DataSourceID {get; set;}

The DataSourceID property gets or sets the ID of the data source component from which the
data-bound control retrieves its data. By setting DataSourceID, you tell the control to turn to the
associated data source control for any needs regarding data—retrieval, paging, sorting, counting,
or updating.

The DataMember Property

The DataMember property gets or sets the name of the data collection to extract when data
binding to a data source:
public virtual string DataMember {get; set;}

The DataTextField Property

Typically used by list controls, the DataTextField property specifies which property of a data-
bound item should be used to define the display text of the n element in a list control:
public virtual string DataTextField {get; set;}

The same happens for ListBox, CheckBoxList, and other list controls. Unlike
DataMember, the DataTextField property is necessary also in case the binding is
operated by data source components.

The DataValueField Property

Similar to DataTextField, the DataValueField property specifies which property of a


data-bound item should be used to identify the nth element in a list control:
public virtual string DataValueField {get; set;}

The AppendDataBoundItems Property

AppendDataBoundItems is a Boolean property that indicates whether the data-bound items


should be appended to or whether they should overwrite the existing contents of the control. By
default, AppendDataBoundItems is set to false, meaning that data-bound contents replace any
existing contents.

public virtual bool AppendDataBoundItems {get; set;}

The DataKeyField Property

public virtual string DataKeyField {get; set;}


The DataKeyField property is coupled with the DataKeys array property. When DataKeyField is
set, DataKeys contains the value of the specified key field for all the control’s data items
currently displayed in the page.

List Controls:

List controls include DropDownList, CheckBoxList, RadioButtonList, ListBox, and, in ASP.NET


2.0, also the BulletedList control. All list controls inherit from the base ListControl class both in
ASP.NET 1.x and 2.0.

The DropDownList Control

The DropDownList control enables users to select one item from a single-selection drop-down
list.

Property Description
AppendDataBoundItems- Indicates whether statically defined items should be maintained or
cleared when adding data-bound items. Not supported in ASP.NET 1.x.

AutoPostBack -Indicates whether the control should automatically post back to the server when
the user changes the selection.

DataMember- The name of the table in theDataSource to bind.


DataSource -The data source that populates the items of the list.
DataSourceID -ID of the data source component to provide data.Not supported in ASP.NET 1.x.
DataTextField -Name of the data source field to supply the text of list
items.
DataTextFormatString- Formatting string used to control list items are displayed.
DataValueField -Name of the data source field to supply the value of a list item.
Items -Gets the collection of items in the list control.
SelectedIndex -Gets or sets the index of the selected item in the list.
SelectedItem -Gets the selected item in the list.
SelectedValue -Gets the value of the selected item in the list.

The programming interface of the DropDownList control also features three properties
to configure the border of the drop-down list: BorderColor, BorderStyle, and
BorderWidth. Although the properties are correctly transformed by style properties, most
browsers won’t use them to change the appearance of the drop-down list.

The CheckBoxList Control

Property Description
AppendDataBoundItems -Indicates whether statically defined items should be
maintained or cleared when adding data-bound items. Not
supported in ASP.NET 1.x.
AutoPostBack -Indicates whether the control should automatically post
back to the server when the user changes the selection.
CellPadding -Indicates pixels between the border and contents of the
cell.

CellSpacing- Indicates pixels between cells.


DataMember -The name of the table in theDataSource to bind.
DataSource -The data source that populates the items of the list.
DataSourceID -ID of the data source component to provide data.Not
supported in ASP.NET 1.x.
DataTextField -Name of the data source field to supply the text of list
items.
DataTextFormatString- Formatting string used to control list items are displayed.
DataValueField- Name of the data source field to supply value of a list
item.

Items -Gets the collection of items in the list control.


RepeatColumns- Gets or sets the number of columns to display in the
control.
RepeatDirection- Gets or sets a value that indicates whether the control
displays vertically or horizontally.
RepeatLayout- Gets or sets the layout of the check boxes (table or flow).
SelectedIndex -Gets or sets the index of the first selected item in the list—
the one with the lowest index.
SelectedItem -Gets the first selected item.
SelectedValue- Gets the value of the first selected item.
TextAlign- Gets or sets the text alignment for the check boxes.

Any list control has an Items property that contains the collection of the child items. The Items
property is implemented through the ListItemCollection class and makes each contained item
accessible via a ListItem object. The following code loops through the items stored in a
CheckBoxList control and checks the Selected property of each of them:
foreach(ListItem item in chkList.Items)
{
if (item.Selected) {
// this item is selected
}
}

The RadioButtonList Control

The RadioButtonList control acts as the parent control for a collection of radio buttons. Each of
the child items is rendered through a RadioButton control. By design, a RadioButtonList control
can have zero or one item selected. The SelectedItem property returns the selected element as a
ListItem object. Note, though, that there is nothing to guarantee that only one item is selected at
any time. For this reason, be extremely careful when you access the SelectedItem of a
RadioButtonList control—it could be null:
if (radioButtons.SelectedValue != null)
{
// Process the selection here
...
}

The ListBox Control


The ListBox control represents a vertical sequence of items displayed in a scrollable window.
The ListBox control allows single-item or multiple-item selection and exposes its contents
through the usual Items collection, as shown in the following code:
<asp:listbox runat="server" id="theListBox"
rows="5" selectionmode="Multiple" />

Two properties make this control slightly different from other list controls—the Rows property,
which represents the number of visible rows in the control, and the SelectionMode property,
which determines whether one or multiple items can be selected. The programming interface of
the list box also contains the set of SelectedXXX properties we considered earlier. In this case,
they work as they do for the CheckBoxList control—that is, they returns the selected item with
the lowest index.

The BulletedList Control


The BulletedList control is a programming interface built around the <ul> and <ol>HTML tags,
with some extra features such as the bullet style, data binding, and support for custom images.
The BulletedList control is not supported in ASP.NET 1.x. The following example uses a custom
bullet object:
<asp:bulletedlist runat="server" bulletstyle="Square">
<asp:listitem>One</asp:listitem>
<asp:listitem>Two</asp:listitem>
<asp:listitem>Three</asp:listitem>
</asp:bulletedlist>

Property Description
AppendDataBoundItems -Indicates whether statically defined items should be
maintained or cleared when adding data-bound items
BulletImageUrl- Gets or sets the path to the image to use as the bullet
BulletStyle- Determines the style of the bullet
DataMember -The name of the table in the DataSource to bind
DataSource- The data source that populates the items of the list
DataSourceID- ID of the data source component to provide data
DataTextField- Name of the data source field to supply text of list items
DataTextFormatString- Formatting string used to control list items are displayed

DataValueField -Name of the data source field to supply value of a list item
DisplayMode -Determines how to display the items: plain text, link
buttons, or hyperlinks
FirstBulletNumber- Gets or sets the value that starts the numbering
Items -Gets the collection of items in the list control
Target- Indicates the target frame in case of hyperlink mode

Iterative Controls
Iterative controls are a special type of data-bound controls that supply a template-based
mechanism to create free-form user interfaces. Iterative controls take a data source, loop through
the items, and iteratively apply user-defined HTML templates to each row. This basic behavior is
common to all three ASP.NET iterators—Repeater, DataList, and DataGrid. Beyond that,
iterative controls differ from each other in terms of layout capabilities and functionality.

The Repeater Control


The Repeater control displays data using user-provided layouts. It works by repeating a specified
ASP.NET template for each item displayed in the list. The Repeater is a rather basic templated
data-bound control. It has no built-in layout or styling capabilities. All formatting and layout
information must be explicitly declared and coded using HTML tags and ASP.NET classes.

Property Description
AlternatingItemTemplate- Template to define how every other item is rendered.
DataMember -The name of the table in theDataSource to bind.
DataSource -The data source that populates the items of the list.
DataSourceID -ID of the data source component to provide data.Not
supported in ASP.NET 1.x.
FooterTemplate -Template to define how the footer is rendered.
HeaderTemplate -Template to define how the header is rendered.
Items -Gets a RepeaterItemCollection object—that is, a collection
of RepeaterItem objects. Each element of the collection
represents a displayed data row in the Repeater.

ItemTemplate -Template to define how items are rendered.


SeparatorTemplate -Template to define how the separator between items is to
be rendered. For the most part, properties are the template elements that form the control’s user
interface. The Repeater populates the Items collection by enumerating all the data items in the
bound data source.

The DataList Control

The DataList is a data-bound control that begins where the Repeater ends and
terminates a little before the starting point of the DataGrid control. In some
unrealistically simple cases, you could even take some code that uses a Repeater,
replace the control, and not even notice any difference. The DataList overtakes the
Repeater in several respects, mostly in the area of graphical layout. The DataList
supports directional rendering, meaning that items can flow horizontally or vertically tomatch a
specified number of columns.

The DataGrid Control

The DataGrid is a column-based control and supports various types of data-bound columns,
including text columns, templated columns, and command columns. You associate the control
with a data source using the DataSource property. Just as for other data-bound controls, no data
will be physically loaded and bound until the DataBind method is called. The simplest way of
displaying a table of data using the ASP.NET grid is as follows:
<asp:DataGrid runat="server" id="grid" />

Data-Binding Expressions:
What we have examined so far is the most common form of data binding that involves list and
iterative controls and collections of data. Note that any ASP.NET controls support some minimal
form of data binding, including text boxes and labels, through the DataBind method.

Simple Data Binding


A data-binding expression is any executable code wrapped by <% ... %> and prefixed by the
symbol #. Typically, you use data-binding expressions to set the value of an attribute in the
opening tag of a server control. A data-binding expression is programmatically managed via an
instance of the DataBoundLiteralControl class.

Binding in Action
Data-binding expressions are particularly useful to update, in a pure declarative
manner, properties of controls that depend on other controls in the same page. For example,
suppose you have a drop-down list of colors and a label, and you want the text of the label to
reflect the selected color:

<asp:DropDownList ID="SelColors" runat="server" AutoPostBack="True">


<asp:ListItem>Orange</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
<asp:ListItem>Red</asp:ListItem>
<asp:ListItem>Blue</asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" ID="lblColor"
Text='<%# "<b>You selected: </b>" + SelColors.SelectedValue %>' />
Note that in the <%# ... %> expression you can use any combination of methods,
constants, and properties as long as the final result matches the type of the bound
property. Also note that the evaluation of the expression requires a postback and a call to
DataBind. We set the AutoPostBack property to true just to force a postback when the selection
changes in the drop-down list.

The DataBinder Class


Earlier in this chapter, we met <%# ... %> expressions in the context of templates along with the
Eval method. The Eval method is a kind of tailor-made operator you use in data-binding
expressions to access a public property on the bound data item. The Eval method as used earlier
is an ASP.NET 2.0–only feature and will generate a compile error if used in ASP.NET 1.x
applications. For all versions of ASP.NET, you can use a functionally equivalent method, also
named Eval, but from another class—DataBinder.

The Eval Method


The syntax of DataBinder.Eval typically looks like this:
<%# DataBinder.Eval(Container.DataItem, expression) %>
The DataItem property represents the object within the current container context. Typically, a
container is the current instance of the item object—for example, a DataGridItem object—that is
about to be rendered.

Other Data-Binding Methods

In ASP.NET 2.0, data-binding expressions go far beyond read-only evaluation of


enumerable and tabular data. In addition to DataBinder, ASP.NET 2.0 provides a class that can
bind to the result of XPath expressions that are executed against an object that implements the
IXPathNavigable interface. This class is named XPathBinder; it plays the same role as
DataBinder, except it works on XML data. The XPathBinder class backs up a new data-binding
method named XPath.

The XPath Method


In ASP.NET 2.0, data-bound controls can be associated with raw XML data. You can bind XML
data in version 1.x, but you have to first fit XML data into a relational structure such as a
DataSet. The following example demonstrates using the simplified XPath data-binding syntax:
<%# XPath("Orders/Order/Customer/LastName") %>

The output value is the object returned by XPathBinder.Eval converted to a string.


Internally, XPathBinder.Eval gets a navigator object from the data source and evaluates the
expression. The managed XPath API is used.

The XPathSelect Method


The XPathBinder class also features a Select method. The method executes an XPath query and
retrieves a nodeset—an enumerable collection of XML nodes. This collection can be assigned as
a late-bound value to data-bound controls (such as the Repeater control). An equivalent
simplified syntax exists for this scenario, too:
<asp:Repeater runat="server"
DataSource='<%# XPathSelect("orders/order/summary") %>'>
...
</asp:Repeater>

The Bind Method

ASP.NET 2.0 supports two-way data binding—that is, the capability to bind data to controls and
submit changes back to the database. The Eval method is representative of a one-way data
binding that automates data reading but not data writing. The new Bind method can be used
whenever Eval is accepted and through a similar syntax:
<asp:TextBox Runat="server" ID="TheNotes" Text='<%# Bind("notes") %>' />

User-Defined Dynamic Expressions


Data-binding expressions are not really dynamic expressions because they are evaluated only
within the context of a data-binding call. ASP.NET 2.0 provides a made-tomeasure infrastructure
for dynamic expressions based on a new breed of components— the expression builders.

Data Source Components


ASP.NET 1.x has an extremely flexible and generic data-binding architecture that gives
developers full control of the page life cycle. Developers can link data-bound controls such as
the DataGrid to any enumerable collection of data.

Data Source Views


A named view is represented by a data source view object—an instance of the
DataSourceView class. These classes represent a customized view of data in which
special settings for sorting, filtering, and other data operations have been defined. The
DataSourceView class is the base class for all views associated with a data source control. The
number of views in a data source control depends on the connection string, characteristics, and
actual contents of the underlying data source.

Updating an Access Database


The AccessDataSource can also be used to perform insert, update, or delete operations against
the associated database. For the data source updates to work, you should grant write permission
to the ASP.NET account on the database file. Alternatively, you can use a different account with
adequate permission.

The ObjectDataSource Control


The ObjectDataSource class enables user-defined classes to associate the output of their methods
to data-bound controls. Like other data source controls, ObjectDataSource supports declarative
parameters to allow developers to pass page-level variables to the object’s methods.

Updating and Deleting Data


To update underlying data using Object Data Source, you need to define an
update/insert/delete method. All the actual methods you use must have semantics that are well-
suited to implement such operations.

public static void Save(Employee emp)


public static void Insert(Employee emp)
public static void Delete(int id)

The Site Map Data Source Class


A site map is the graph that represents all the pages and directories found in a Web site.
Displaying Site Map Information
The site map information can appear in many ways, the simplest of which is an XML file named
web.sitemap located in the root of the application. The file describes the relationship between
pages on the site.

The Xml Data Source Class


The Xml Data Source control is a special type of data source control that supports both tabular
and hierarchical views of data.

Displaying XML Data


The Xml Data Source control is commonly bound to a hierarchical control, such as the TreeView
or Menu. (These are the only two built-in hierarchical controls we have in ASP.NET 2.0, but
others can be created by developers and third-party vendors.)

Transforming XML Data


The Xml Data Source class can also transform its data using Extensible Style sheet
Language Transformations (XSLT). You set the transform file by using the
Transform File property or by assigning the XSLT content to the string property named
Transform.

Conclusion
ASP.NET data binding has three faces—classic source-based binding as in ASP.NET 1.x, data
source controls, and data-binding expressions. Data-binding expressions serve a different
purpose from the other two binding techniques. Expressions are used declaratively and within
templated controls. They represent calculated values bindable to any property

Crystal Report Design

Crystal Reports provides you with a variety of options for formatting your report, including grouping,
sorting and totaling. Crystal Reports also enables you to format the visual elements of your report, such as
fonts, character styles, borders, graphics and headers. It can connect to any RDBMS and generate report
according to user needs.

Report Data Organization


Keeping your data well organized will help ensure that your report is easy to read. This section provides
some basic procedures for organizing report data so information can be easily and clearly understood by
the reader.
Defining a record selection criterion: The “Select Expert” crystal report allows users to define
limitations to record selection criteria. It works similar to the WHERE clause of an SQL query statement.

Grouping records: A well-designed report is organized so readers can easily analyze information.
Grouping similar sets of records helps readers isolate and study specific information.

Setting record order: Records ordering allows you to prioritize the appearance of specific pieces of
information in the report. Records are sorted so information can be presented in a way that is most helpful
to the reader.

Adding summaries: Crystal Reports provides many tools for analyzing information that has been drawn
from a database. A good example is the ability to summarize data.

Defining Report Appearance


Crystal Reports enables you to manipulate font families or character styles, add borders, pictures, coloring
or shading to enhance the appearance of your report.

Creating report and page headers: Report Headers and page headers can be created by placing text
objects in the header sections of the Design tab. Report headers appear at the top of the first page of the
report. Page headers appear at the head of each page.

Arranging fields: Fields can be arranged within a report by clicking and dragging.

Modifying text: Once you have placed a text object within your report, you can change text
characteristics to fit the overall appearance of your report.

Adding a template: Crystal Reports offers predefined report templates that can be used to apply a
uniform style to the visual components of your report. The template defines a report's visual
characteristics, such as font size and color, borders, and background colors or shading.

You might also like