
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A detailed guide on various aspects of asp.net programming, including html and web server controls, web user controls, validation controls, data base connectivity, grid view management, and state management. It covers writing programs for calculators, implementing validation controls, and performing database operations using procedures. The document also introduces asp.net ajax and its components, as well as the asp.net component model and page life cycle.
Typology: Exercises
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Sr no
Topic Name of the Program Pg. no
1 Introduction to ASP.NET:
♦ NET Framework (CLR, CLI, BCL)
♦ ASP.NET Basics
2 Controls: ♦ (Properties and Methods of)
♦ Write a Program to make calculator using controls
♦ Write a program to implement validation controls
3 Data Base Connectivity
♦. Introduction to ADO.NET, Data Binding,
♦ Procedure to create database connection.
♦ Program to make form for database ♦ (^) Program to insert data in database ♦ Program to display data in data list ♦ Program to update data ♦ Program to delete data ♦ Program to display data ♦ Program to perform
.NET Framework
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites. It allows you to use a full featured programming language such as C# or VB.NET to build web applications easily
(1) Common Language Runtime or CLR It performs memory management, exception handling, debugging, security checking, thread execution, code execution, code safety, verification, and compilation. The code that is directly managed by the CLR is called the managed code. When the managed code is compiled, the compiler converts the source code into a CPU independent intermediate language (IL) code. A Just In Time(JIT) compiler compiles the IL code into native code, which is CPU specific. (2) .Net Framework Class Library It contains a huge library of reusable types. classes, interfaces, structures, and enumerated values, which are collectively called types.
(3) Common Language Specification It contains the specifications for the .Net supported languages and implementation of language integration. (4) Common Type System It provides guidelines for declaring, using, and managing types at runtime, and cross-language communication. (5) Metadata and Assemblies Metadata is the binary information describing the program, which is either stored in a portable executable file (PE) or in the memory. Assembly is a logical unit consisting of the assembly manifest, type metadata, IL code, and a set of resources like image files. (6) Windows Forms Windows Forms contain the graphical representation of any window displayed in the application. (7) ASP.NET and ASP.NET AJAX ASP.NET is the web development model and AJAX is an extension of ASP.NET for developing and implementing AJAX functionality. ASP.NET AJAX contains the components that allow the developer to update data on a website without a complete reload of the page. (8) ADO.NET It is the technology used for working with data and databases. It provides access to data sources like SQL server, OLE DB, XML etc. The ADO.NET allows connection to data sources for retrieving, manipulating, and updating data. (9) Windows Workflow Foundation (WF) It helps in building workflow-based applications in Windows. It contains activities, workflow runtime, workflow designer, and a rules engine. (10) Windows Presentation Foundation It provides a separation between the user interface and the business logic. It helps in developing visually stunning interfaces using documents, media, two and three dimensional graphics, animations, and more. (11) Windows Communication Foundation (WCF) It is the technology used for building and executing connected systems. (12) Windows CardSpace It provides safety for accessing resources and sharing personal information on the internet. (13) LINQ It imparts data querying capabilities to .Net languages using a syntax which is similar to the tradition query language SQL.
ASP.NET - Introduction 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.
application is made of pages. When a user requests an ASP.NET page, the IIS delegates the
processing of the page to the ASP.NET runtime system. The ASP.NET runtime transforms the .aspx page into an instance of a class, which inherits from the base class page of the .Net framework. Therefore, each ASP.NET page is an object and all its components i.e., the server-side controls are also objects.
ASP.NET provides an abstraction layer on top of HTTP on which the web applications are built. It provides high-level entities such as classes and components within an object-oriented paradigm. The key development tool for building ASP.NET applications and front ends is Visual Studio. In this tutorial, we work with Visual Studio 2008. Visual Studio is an integrated development environment for writing, compiling, and debugging the code. It provides a complete set of development tools for building ASP.NET web applications, web services, desktop applications, and mobile applications.
Microsoft provides a free version of visual studio which also contains SQL Server and it can be downloaded from www.visualstudio.com. Step 1 − Once downloading is complete, run the installer. The following dialog will be displayed.
Step 2 − Click on the Install button and it will start the installation process.
Step 4 − Open Visual Studio from start Menu which will open the following dialog. It will be a
while for the first time for preparation.
Step 5 − Once all is done you will see the main window of Visual studio.
Let’s create a new project from File → New → Project
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:
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:
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:
When a new web form is created, Visual Studio automatically generates the starting HTML for
the form and displays it in Source view of the web forms designer. The Solution Explorer is used to add any other files, folders or any existing item on the web site.
A typical ASP.NET application consists of many items: the web content files (.aspx), source files (.cs files), assemblies (.dll and .exe files), data source files (.mdb files), references, icons, user controls and miscellaneous other files and folders. All these files that make up the website are contained in a Solution. When a new website is created. VB2008 automatically creates the solution and displays it in the solution explorer. Solutions may contain one or more projects. A project contains content files, source files, and other files like data sources and image files. Generally, the contents of a project are compiled into an assembly as an executable file (.exe) or a dynamic link library (.dll) file. Typically a project contains the following content files:
You can execute an application by:
The program is built meaning, the .exe or the .dll files are generated by selecting a command from the Build menu.
HTML ServerControls
The HTML server controls are basically the standard HTML controls enhanced to enable server side processing. The HTML controls such as the header tags, anchor tags, and input elements are not processed by the server but are sent to the browser for display. They are specifically converted to a server control by adding the attribute run at="server" and adding an id attribute to make them available for server-side processing. For example, consider the HTML input control:
It could be converted to a server control, by adding the run at and id attribute:
Although ASP.NET server controls can perform every job accomplished by the HTML server controls, the later controls are useful in the following cases:
ASP.NET server controls are the primary controls used in ASP.NET. These controls can be grouped into the following categories:
The syntax for using server controls is:
In addition, visual studio has the following features, to help produce in error-free coding:
ASP.NET server controls with a visual aspect are derived from the WebControl class and inherit all the properties, events, and methods of this class. The WebControl class itself and some other server controls that are not visually rendered are derived from the System.Web.UI.Control class. For example, PlaceHolder control or XML control. ASP.Net server controls inherit all properties, events, and methods of the WebControl and System.Web.UI.Control class. The following table shows the inherited properties, common to all server controls:
Property Description AccessKey Pressing this key with the Alt key moves focus to the control. 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.
ChildControlCreated It indicates whether the server control's child controls have been created.
ClientID Control ID for HTML markup.
Context The HttpContext object associated with the server control.
Controls Collection of all controls contained within the control.
ControlStyle The style of the Web server control.
CssClass CSS class
DataItemContainer Gets a reference to the naming container if the naming container implements IDataItemContainer.
DataKeysContainer Gets a reference to the naming container if the naming container implements IDataKeysControl.
DesignMode It indicates whether the control is being used on a design surface.
DisabledCssClass Gets or sets the CSS class to apply to the rendered HTML element when the control is disabled.
Enabled Indicates whether the control is grayed out.
EnableTheming Indicates whether theming applies to the control.
EnableViewState Indicates whether the view state of the control is maintained.
Events Gets a list of event handler delegates for the control.
Font Font.
Forecolor Foreground color.
HasAttributes Indicates whether the control has attributes set.
HasChildViewState Indicates whether the current server control's child controls have any saved view-state settings.
Height Height in pixels or %.
ID Identifier for the control.
IsChildControlStateCleared Indicates whether controls contained within this control have control state.
IsEnabled Gets a value indicating whether the control is enabled.
IsTrackingViewState It indicates whether the server control is saving changes to its view state.
IsViewStateEnabled It indicates whether view state is enabled for this control.
LoadViewStateById It indicates whether the control participates in loading its view state by ID instead of index.
Page Page containing the control.
Parent Parent control.
RenderingCompatibility It specifies the ASP.NET version that the rendered HTML will be compatible with.
Site The container that hosts the current control when rendered on a design surface.