Docsity

ASP.net Computer Applications, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
ITTERMS
A PROJECT REPORT
Submitted to punjab Institute of Management and technology in
partialfulfillment of the requirement for the award of the Degree
Of
bechlor of computer Applications (bCA)
(Batch 2016-2019)
SUBMITTED TO: SUBMITTED BY:
Mr. Amit Verma. Suhail Shams
Lone. BCA 5th
sem. Roll No: 1638901
PUNJAB INSTITUTE OF MANANGEMENT AND TECHNOLOGY (bCA)
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Partial preview of the text

Download ASP.net Computer Applications and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

ITTERMS

A PROJECT REPORT

Submitted to punjab Institute of Management and technology in

partialfulfillment of the requirement for the award of the Degree

Of

bechlor of computer Applications (bCA)

(Batch 2016-2019)

SUBMITTED TO: SUBMITTED BY:

Mr. Amit Verma. Suhail Shams

Lone. BCA 5 th

sem. Roll No: 1638901

PUNJAB INSTITUTE OF MANANGEMENT AND TECHNOLOGY (bCA)

INDEX

S.NO. NAME OF THE CHAPTER^ PAGE

NO.

REMARK

1. INTRODUCTION TO ASP.NET

  • .Net Framework (CLR, CLI, BCL)
  • ASP.NET basics.
  • ASP.NET page structure.
  • Page Life Cycle.

2. CONTROLS

  • HTML Server Control.
  • Web Server Control.
  • Web User Control.
  • Validation Control.
  • Custom Web Control.

3 STATE MANAGEMENT

  • View, Control State.
  • Hidden Fields, Cookies, Query String.
  • Application State, Session State.
  • Profile Properties.

4 MASTER PAGES

Introduction to ASP.NET

.NET Framework: -

ASP.Net is a framework which is used to develop a Web-based application. The basic architecture of the ASP.Net framework is as shown below.

Common Language Runtime(CLR): -

The Common Language Infrastructure or CLI is a platform. .Net programs are executed on this platform. The CLR is used for performing key activities. Activities include Exception handling and Garbage collection.

Common Language Infrastructure(CLI) : -

Part of Microsoft's .NET strategy, Common Language Infrastructure (CLI) enables an

application programwritten in any of several commonly-used programming languages to be run

on any operating system using a common runtime program rather than a language-specific one.

Common Language Infrastructure provides a virtual execution environment comparable to the

one provided by Sun Microsystems for Java programs.

Base Class Library(BCL):-

The Commerce Server Base Class Library is a collection of classes, interfaces, and value

types that are included in the Commerce Server .NET Application Framework. This library

provides access to run-time Commerce Server functionality and is designed to be the foundation

on which .NET-based Commerce Server applications are built. The Base Class Library exposes

an API that is optimized for the .NET Frameworkwhile using the services provided by the

Common Language Runtime Interop Layer.

ASP.NET Basics

ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required to build up robust web applications for PC, as well as mobile devices.

ASP.NET works on top of the HTTP protocol, and uses the HTTP commands and policies to set a browser-to-server bilateral communication and cooperation.

ASP.NET is a part of Microsoft .Net platform. ASP.NET applications are compiled codes, written using the extensible and reusable components or objects present in .Net framework. These codes can use the entire hierarchy of classes in .Net framework.

The ASP.NET application codes can be written in any of the following languages:

  • C#
  • Visual Basic.Net
  • Jscript
  • J#

ASP.NET is used to produce interactive, data-driven web applications over the internet. It consists of a large number of controls such as text boxes, buttons, and labels for assembling, configuring, and manipulating code to create HTML pages.

Example:

ASP.Net Page Life cycle

When an ASP.Net page is called, it goes through a particular lifecycle. This is done before the

response is sent to the user. There are series of steps which are followed for the processing of an ASP.Net page.

Let's look at the various stages of the lifecycle of an ASP.Net web page.

1. Page Request -

This is when the page is first requested from the server. When the page is requested, the server checks if it is requested for the first time. If so, then it needs to compile the page, parse the response and send it across to the user. If it is not the first time the page is requested, the cache is checked to see if the page output exists. If so, that response is sent to the user.

2. Page Start –

During this time, 2 objects, known as the Request and Response object are created. The Request object is used to hold all the information which was sent when the page was requested. The Response object is used to hold the information which is sent back to the user.

3. Page Initialization –

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 tag are

processed.

PreLoad:

PreLoad occurs before the post back data is loaded in the controls. This event can be handled by overloading the OnPreLoad 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 OnLoadComplete method or creating a Page_LoadComplete 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:

Controls

HTML Server Controls: - By default, HTML elements within an ASP.NET file are treated

as literal text and are programmatically inaccessible to page developers. To make these elements programmatically accessible, you can indicate that an HTML element should be parsed and treated as a server control by adding a runat="server" attribute.

The unique id attribute allows you to programmatically reference the control. Attributes are used to declare property arguments and event bindings on server control instances.

HTML server controls must reside within a containing tag with the runat="server" attribute.

HTML Server Controls: Description

HtmlAnchor Controls an HTML element. HtmlButton Controls a HTML element

HtmlForm Controls a HTML element.

HtmlGeneric Controls other HTML elements not specified by a specific HTML server controls, like , , etc. HtmlImage Controls an element

HtmlInputButton Controls ,and Html element. HtmlInputCheckBox Controls an HTML element.

HtmlInputFile Controls an html element.

HtmlInputHidden Controls an html element.

HtmlInputImage Controls an html element.

HtmlInputRadioButton Controls an html element.

HtmlInputText Controls an and html element. HtmlSelect Controls a Html element.

HtmlTable Controls a Html element.

HtmlTableCell Controls a and Html element.

HtmlTableRow Controls a Html element.

HtmlTextArea Controls a Web Server Control Description AdRotator Displays a sequence of images. Button Displays a push button. Calender Displays a calendar. CalendarDay A day in a calendar control. CheckBox Displays a checkbox. CheckBoxList Creates a multi-selection checkbox group. DataGrid Displays fields of data source in grid. DataList Displays items from a data source by using templates. DropDownList Creates a Drop-down List. HyperLink Creates a hyperlink. Image Displays an image. ImageButton Displays a clickable image. Label Display static content which is programmable (lets you apply styles to its content). LinkButton Creates a hyperlink button. ListBox Creates a single or multi-selection drop-down List. ListItem Creates an item in a list. Literal Display static content which is programmable (does not let you apply styles to its content). Panel Provides a container for other controls. PlaceHolder Reserves space for controls added by code. RadioButton Creates a radio-button. RadioButtonList Creates a group of radio-buttons. BulletedList Creates a list in bullet format. Repeater Displays a repeated list of items bound to the control. Style Sets the style of controls. Table Creates a table. TableCell Creates a table cell. TableRow Creates a table row. TextBox Creates a text box. Xml Displays an XML file or the results of an XSL transform.

Web User Controls: -

At times, you might need functionality in a control that is not provided by the built-in ASP.NET Web server controls. In those cases, you can create your own controls. You have two options.

User controls. User controls are containers into which you can put markup and Web server controls. You can then treat the user control as a unit and define properties and methods for it.

  1. add the user control to your web page, you must add the register directive and an instance of the user control to the page. The following code shows the content file:

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="Defa ult"%> <%@RegisterSrc="~/footer.ascx"TagName="footer"TagPrefix="Tfooter"%>

User Control

When executed, the page shows the footer and this control could be used in all pages of your website.

Validation Controls:-

An important aspect of creating ASP.NET Web pages for user input is to be able to check that the information users enter is valid. ASP.NET provides a set of validation controls that provide an easy-to-use but powerful way to check for errors and, if necessary, display messages to the user. The topics in this section describe the validation controls and how to use them.

Validation Control Description

CompareValidator Compares the value of one input control to the value of another input control CustomValidator Allows you to write a method to handle the validation of the value entered RangeValidator Checks that the user enters a value that falls between two values

RegularExpressionValidator Ensures that the value of an input control matches a specified value

RequiredFieldValidator Makes an input control a required field

ValidationSummary Displays a report of all validation errors occurred in a Web Page.

Custom Web Control:-

Custom control is a control that is not included in the .NET framework library and is

instead created by a third-party software vendor or a user. Custom control is a concept used

while building both Windows Forms client and ASP.NET Web applications.

Type: It specifies the data type.

ControlToCompare: It specifies the value of the input control to compare with. ValueToCompare: It specifies the constant value to compare with. Operator: It specifies the comparison operator, the available values are: Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, and DataTypeCheck.

The basic syntax of the control is as follows:

RegularExpressionValidator :

The RegularExpressionValidator control allows validating the input text by matching

against a pattern of a regular expression. The regular expression is set in the ValidationExpression property.

The syntax of the control is as given:

CustomValidator:

The CustomValidator control allows writing application specific custom validation routines

for both the client side and the server side validation.

The client side validation is accomplished through the ClientValidationFunction property.

The client side validation routine should be written in a scripting language, such as JavaScript or VBScript, which the browser can understand.

The basic syntax for the control is as given:

ValidationSummary:

The ValidationSummary control does not perform any validation but shows a summary of all errors in the page. The summary displays the values of the ErrorMessage property of all validation controls that failed validation. The following two mutually inclusive properties list out the error message:

ShowSummary: shows the error messages in specified format. ShowMessageBox: shows the error messages in a separate window.

The syntax for the control is as given:

State Management

A new instance of the Web page class is created each time the page is posted to the server. In traditional Web programming, this would typically mean that all information associated with the page and the controls on the page would be lost with each round trip. For example, if a user enters information into a text box, that information would be lost in the round trip from the browser or client device to the server.

To overcome this inherent limitation of traditional Web programming, ASP.NET includes several options that help you preserve data on both a per-page basis and an application-wide basis. These features are as follows:

  • View state
  • (^) Control state
  • Hidden fields