SlideShare a Scribd company logo
UNIT-I
CS DEPT
SIASC
ASP.NET
Syllabus
 UNIT I : ASP.NET Basics
 Introduction to ASP.NET: .NET Framework (CLR, CLI,
BCL), ASP.NET Basics, ASP.NET Page Structure, Page Life
Cycle. Controls: HTML Server Controls, Web Server Controls,
Web User Controls, Validation Controls, Custom Web
Controls.
 UNIT II: Form
 Form validation: Client side validation, Server side validation,
Validation Controls: Required Field Comparison Range,
Calendar Control, Ad rotator Control, Internet Explorer
Control. State Management: View State, Control State, Hidden
Fields, Cookies, Query Strings, Application State, Session
State.
Syllabus
 UNIT III: ADO.NET
 Architecture of ADO .NET, Connected and Disconnected Database, Create
Database, Create connection Using ADO.NET Object model, Connection Class,
Command Class, Data Adapter Class, Dataset Class, Display data on data bound
controls and Data Grid.
 UNIT IV: Database accessing
 Database accessing on Web Applications: Data Binding Concept with web,
Creating Data Grid, Binding standard web server controls, Display data on web
form using Data Bound Controls.
 UNIT V: XML
 Writing Datasets to XML, Reading datasets with XML. WEB services: Remote
method call using XML, SOAP, Web service description language, Building and
Consuming a web service, Web Application deployment.
ASP
 ASP—ACTIVE SERVER PAGES
 Server side scripting Environment  used to
create and run dynamic ,interactive, high-
performance web server applications.
 Script  Server side
 Browser  RequestWeb
serverResponsebrowser
ASP
 Extension– asp.
 1.text
 2.Html tags
 3.Script commands—instructs our computer to do
something
 Microsoft –webmatrix
.NET
 .NET is a free, cross-platform ,open source
developer platform for building many different
types of application.
 With .NET, you can use multiple langauage
,editors, and libraries to build for web ,mobile
,desktop ,gaming and iot.
 Programming languges – C#,VB,F#
 .NET Application create IDE—Visual Studio
.NET
 .NET support implementation
 .NET Core
 .Net Framework
 .NET framework windows create application.
.NET Framework version
.NET CORE VERSION
Introduction to ASP.NET
 ASP.NET is a web application framework designed and
developed by Microsoft. ASP.NET is open source and a subset
of the .NET Framework and successor of the classic
ASP(Active Server Pages). With version 1.0 of the .NET
Framework, it was first released in January 2002. So a
question comes to mind that which technology we were using
before the year 2002 for developing web applications and
services?
 Answer is Classic ASP. So before .NET and ASP.NET there
was Classic ASP.
 ASP.NET is built on the CLR(Common Language
Runtime) which allows the programmers to execute its code
using any .NET language(C#, VB etc.). It is specially designed
to work with HTTP and for web developers to create dynamic
web pages, web applications, web sites, and web services as
it provides a good integration of HTML, CSS, and JavaScript.
 .NET Framework is used to create a variety of applications
and services like Console, Web, and Windows, etc. But
ASP.NET is only used to create web applications and web
services. That’s why we termed ASP.NET as a subset of the
What is ASP.Net
 ASP.Net is a web development platform provided by
Microsoft. It is used for creating web-based
applications. ASP.Net was first released in the year
2002.
 The first version of ASP.Net deployed was 1.0. The
most recent version of ASP.Net is version 4.6.
ASP.Net is designed to work with the HTTP protocol.
This is the standard protocol used across all web
applications.
 ASP.Net applications can also be written in a variety
of .Net languages. These include C#, VB.Net, and J#.
In this chapter, you will see some basic fundamental
of the .Net framework.
 The full form of ASP is Active Server Pages, and .NET
is Network Enabled Technologies.
ASP.NET ARCHITECTURE
ASP.NET ARCHITECTURE
 The architecture of the.Net framework is based on the
following key components
 Language – A variety of languages exists for .net
framework. They are VB.net and C#. These can be
used to develop web applications.
 Library - The .NET Framework includes a set of
standard class libraries. The most common library
used for web applications in .net is the Web library.
The web library has all the necessary components
used to develop.Net web-based applications.
 Common Language Runtime - 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
COMPONENTS OF .NET
FRAMEWORK
COMPONENTS OF .NET
FRAMEWORK
 Enterprise applications. It mainly contains two components,
 1. Common Language Runtime (CLR)
 2. .Net Framework Class Library.
 Common Language Runtime (CLR)
.Net Framework provides runtime environment called Common
Language Runtime (CLR).It provides an environment to run all
the .Net Programs. The code which runs under the CLR is called
as Managed Code. Programmers need not to worry on
managing the memory if the programs are running under the
CLR as it provides memory management and thread
management.
Programmatically, when our program needs memory, CLR
allocates the memory for scope and de-allocates the memory if
the scope is completed.
Language Compilers (e.g. C#, VB.Net, J#) will convert the
Code/Program to Microsoft Intermediate Language (MSIL)
intern this will be converted to Native Code by CLR. See the
below Fig.
COMPONENTS OF .NET
FRAMEWORK
COMPONENTS OF .NET
FRAMEWORK
 .Net Framework Class Library (FCL)
This is also called as Base Class Library and it is
common for all types of applications i.e. the way you
access the Library Classes and Methods in VB.NET
will be the same in C#, and it is common for all other
languages in .NET.
The following are different types of applications that
can make use of .net class library.
 1. Windows Application.
 2. Console Application
 3. Web Application.
 4. XML Web Services.
 5. Windows Services.
COMPONENTS OF .NET
FRAMEWORK
 Common Type System (CTS)
It describes set of data types that can be used in different .Net languages in common.
(i.e), CTS ensures that objects written in different .Net languages can interact with
each other.
For Communicating between programs written in any .NET complaint language, the
types have to be compatible on the basic level.
 Common Language Specification (CLS)
It is a sub set of CTS and it specifies a set of rules that needs to be adhered or
satisfied by all language compilers targeting CLR. It helps in cross language
inheritance and cross language debugging.
Common language specification Rules:
It describes the minimal and complete set of features to produce code that can be
hosted by CLR. It ensures that products of compilers will work properly in .NET
environment.
 Sample Rules:
 1. Representation of text strings
 2. Internal representation of enumerations
 3. Definition of static members and this is a subset of the CTS which all .NET
languages are expected to support.
 4. Microsoft has defined CLS which are nothing but guidelines that language to follow
so that it can communicate with other .NET languages in a seamless manner.
COMPONENTS OF .NET
FRAMEWORK

CHARACTERISTICS OF .NET
FRAMEWORK
 Code Behind Mode – This is the concept of separation of design and code. By
making this separation, it becomes easier to maintain the ASP.Net application. The
general file type of an ASP.Net file is aspx. Assume we have a web page called
MyPage.aspx. There will be another file called MyPage.aspx.cs which would denote
the code part of the page. So Visual Studio creates separate files for each web page,
one for the design part and the other for the code.
 State Management – ASP.Net has the facility to control state management. HTTP is
known as a stateless protocol. Let's take an example of a shopping cart application.
Now, when a user decides what he wants to buy from the site, he will press the submit
button.
 The application needs to remember the items the user choose for the purchase. This
is known as remembering the state of an application at a current point in
time. HTTP is a stateless protocol. When the user goes to the purchase page, HTTP
will not store the information on the cart items. Additional coding needs to be done to
ensure that the cart items can be carried forward to the purchase page. Such an
implementation can become complex at times. But ASP.Net can do state management
on your behalf. So ASP.Net can remember the cart items and pass it over to the
purchase page.
 Caching – ASP.Net can implement the concept of Caching. This improve's the
performance of the application. By caching those pages which are often requested by
the user can be stored in a temporary location. These pages can be retrieved faster
and better responses can be sent to the user. So caching can significantly improve the
performance of an application.
 ASP.Net is a development language used for constructing web-based applications.
ASP.Net is designed to work with the standard HTTP protocol.
ASP.Net Lifecycle
ASP.Net Lifecycle
 1) Application Start - The life cycle of an ASP.NET application starts
when a request is made by a user. This request is to the Web server for
the ASP.Net Application. This happens when the first user normally goes
to the home page for the application for the first time. During this time,
there is a method called Application start which is executed by the web
server. Usually, in this method, all global variables are set to their default
values.
 2) Object creation - The next stage is the creation of the Http Context,
Http Request & Http Response by the web server. The Http Context is
just the container for the Http Request and Http Response objects. The
Http Request object contains information about the current request,
including cookies and browser information. The Http Response object
contains the response that is sent to the client.
 3) Http Application creation - This object is created by the web server.
It is this object that is used to process each subsequent request sent to
the application. For example, let's assume we have 2 web applications.
One is a shopping cart application, and the other is a news website. For
each application, we would have 2 Http Application objects created. Any
further requests to each website would be processed by each Http
Application respectively.
ASP. Net Lifecycle
 4) Dispose - This event is called before the
application instance is destroyed. During this
time, one can use this method to manually
release any unmanaged resources.
 5) Application End - This is the final part of the
application. In this part, the application is finally
unloaded from memory
ASP.Net Page Lifecycle
ASP.Net Page Lifecycle
 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.
 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.
 Page Initialization – During this time, all the controls on a web page is initialized. So if you
have any label, textbox or any other controls on the web form, they are all initialized.
 Page Load – This is when the page is actually loaded with all the default values. So if a
textbox is supposed to have a default value, that value is loaded during the page load time.
 Validation – Sometimes there can be some validation set on the form. For example, there
can be a validation which says that a list box should have a certain set of values. If the
condition is false, then there should be an error in loading the page.
 Post back event handling – This event is triggered if the same page is being loaded again.
This happens in response to an earlier event. Sometimes there can be a situation that a user
clicks on a submit button on the page. In this case, the same page is displayed again. In
such a case, the Post back event handler is called.
 Page Rendering – This happens just before all the response information is sent to the user.
All the information on the form is saved, and the result is sent to the user as a complete web
page.
 Unload – Once the page output is sent to the user, there is no need to keep the ASP.net web
form objects in memory. So the unloading process involves removing all unwanted objects
from memory.
STRUCTURE ASP. NET PAGE
 The Structure of an ASP.NET Page
 The main components of an ASP.NET page are:
• Directives
• Code Declaration Blocks
• ASP.NET Controls
• Code Render Blocks
• Server-Side Comments
• Server-Side Include Directives
• Literal Text and HTML Tags.
STRUCTURE ASP. NET PAGE
 Directives
 A directive controls how the page is compiled. It is marked by the
tags, <%@ and %>. It can appear anywhere in a page. But,
normally it is placed at the top of a page. The main types of
directives are:
• Page
• Import
A Page directive is used to specify the default programming
language for a page.
<%@ Page Language="C#" %>
OR
<%@ Language="C#" %>
Some namespaces are imported into an ASP.NET page by
default. If you wish to use a class that is not contained in the
default namespaces, you must import its namespace.
<%@ Import Namespace="System.Data.SqlClient" %>
STRUCTURE ASP. NET PAGE
 Code Declaration Blocks
 A code declaration block contains all the application logic for a page. It also
includes declarations of global variables, and functions. It must be written
within the script runat= "server" tag.
 <script runat=”server”>
 Protected void page_load(object sender,EventArgs e)
 {
 //statements
 }
 Protected void btnAdd_click(object sender,EventArgs e)
 {
 //statements
 }
 </script>

The <script> tag has two optional parameters:
• Language: You can specify the programming language to be used within the
<script> tag. Otherwise, the language specified in the Page directive is used.
• SRC: You can specify an external file that contains the code block.
STRUCTURE ASP. NET PAGE
 Using an external file
 <script runat=”server” src=”external file.aspx”/>
 <html><head><title>including an external file</title></head>
 <form runat=”server”><center>
 <asp:label id=”lblmsg” runat=”server”/>
 <asp:button id=”btnsubmit” text=”click” onclick=”btnsubmit_click”
runat=”server”/>
 </center></form></html>
 //the external file “externalfile.aspx” is shown below:
 Protected void btnsubmit_click(source As object ,E As
EventArgs )
 {
 Lblmsg.text=”HelloWorld”;
 }
 There is no difference in output between writing the code on the
same page and including an external script file.
STRUCTURE ASP. NET PAGE
 ASP.NET Controls
 ASP.NET controls can be mixed with text and static
HTML in a page. All controls must appear within a
<form runat= "server"> tag. Some controls such as
<span runat= "server"> and the Label control can
appear outside this tag. You can have only one form
per page in ASP.NET.
STRUCTURE ASP. NET PAGE
 Code Render Blocks
 If you wish to execute code within HTML, you can include the
code within code render blocks. There are two types of code
render blocks:
• Inline Code: It executes a statement or series of statements.
It is marked by the characters <% and %>.
• Inline Expressions: They display the value of a variable or
method. They can be considered as shorthand notation for
the Response. Write method. They are marked by the
characters <%= and %>.
 <html>
 <head><title>code Render Blocks</title></head>
 <%Dim Strvar As String Strvar=”this is a test variable1”%>
 <% =strvar%>
 <p>
 <% Strvar==”this is a test variable2”%>
 <% =strvar%>< /html>
STRUCTURE ASP. NET PAGE
 Server-Side Comments
 You can add comments in server-side code using the
characters <%-- and --%>. The main use of these comment
blocks is to add documentation to a page.
 <html>
 <head><title>code Render Blocks</title></head>
 <%Dim Strvar As String Strvar=”this is a test variable1”%>
 <% =strvar%>
 <%--------
 <p>
 <% Strvar==”this is a test variable2”%>
 <% =strvar%>
 --------%>
 < /html>
STRUCTURE ASP. NET PAGE
 Server-Side Include Directives
 You can include a file in an ASP.NET page by using a
server-side include directive. It is executed before any of
the code in the page. If the file is in the same directory or
in a sub-directory of the page including the file, this
directive is written as:
<!-- #INCLUDE file="includedfile.aspx" -->
You can also specify the virtual path of the file. To include
a file located in the directory MyAspx under the wwwroot
directory, you will write the directive as:
<!-- #INCLUDE virtual="/MyAspx/includedfile.aspx" -->
Note: It is recommended that you avoid using server-side
include directives. It is better to use user controls.

STRUCTURE ASP. NET PAGE
 HTML Tags and Literal Text
 You can build the static part of an ASP.NET page using HTML tags and literal text. The
HTML content of your page is also compiled along with the rest of the contents.
The literal text has been made bold and converted to uppercase before being
rendered in the browser.
 <script Runat=”server”>
 Protected void page_load(object sender, Eventargs e)
 {
 foreach(Literal controlICcontrol in page.controls)
 {
 ICcontrol.text=”<b>”+(ICcontrol.text.Toupper());
 }
 }
 </script>
 <html><head><title>Literalcontrolclass</title></head>
 <p>this is some literal text </html>
 Output
 THIS IS SOME LITERAL TEXT
ASP.NET – SERVER CONTROLS
SERVER CONTROL
Asp.net server controls are the primary controls
used in Asp.net. These controls can be grouped
into following categories There are three kinds of
server controls
 Html Server Controls-traditional HTML Tags
 Web Server Controls-New Asp.net tags
 Validation Server Controls-For input validation
HTML SERVER CONTROLS
 HTML server controls are Html tags understood
by the server .
 HTML elements in ASP.NET files are by default,
treated as text .to make these elements
programmable ,add a runat=“server” attributes to
the html element. The attributes indicates that the
element should be treated as a server control.
 The
SYSTEM.WEB.UI.HTMLCONTROLS.HTMLCON
TROL base class contains all of the common
properties.html server derive from this class.
HTML SERVER CONTROLS
WEB SERVER CONTROLS
 Web server controls are special asp.net tags
understood by the server.
 Like html server controls, web server controls are
also created on the server and they require a
runat=“server” attribute to work.
 Mostly all web server controls inherit from a
common base class ,namely the WEBCONTROL
class defined in the System.Web.UI.Webcontrols
namespace
 The syntax are web server controls
<asp:TextBox ID="txtFirstName"
runat="server"></asp:TextBox>
WEB SERVER CONTROLS
 Text box
 Button
 Literal
 Drop Down List Box
 Option button and etc.,
WEB SERVER CONTROLS –
TEXTBOX,BUTTON
WEB SERVER CONTROLS
WEB SERVER CONTROLS-
OUTPUT
WEB SERVER CONTROLS-
LITERAL,LABEL,TEXTBOX,BUTTO
N
WEB SERVER CONTROLS
WEB SERVER CONTROLS
WEB SERVER CONTROLS-
DROPDOWNLISTBOX
WEB SERVER CONTROLS-DROP
DOWN LIST BOX
WEB SERVER CONTROLS-DROP
DOWN LIST BOX
WEB SERVER CONTROLS-DROP
DOWN LIST BOX
WEB SERVER CONTROLS
WEB SERVER CONTROLS-
OPTION BUTTON
WEB SERVER CONTROLS-
OPTION BUTTON
WEB SERVER CONTROLS-
OPTION BUTTON
WEB SERVER CONTROLS-
OPTION BUTTON
WEB SERVER CONTROLS-
OPTION BUTTON
VALIDATION CONTROLS
 Validation controls-These are used to validate
user input and they work by running client side
script.
 Validation server controls are used to validate
user- input .If the user-input does not pass
validation ,it will display an error message to the
user.
 Each validation control performs a specific type of
validation (like validating against a specific value
or a range value).
VALIDATION CONTROLS
 The syntax for creating a validation server control
is:
 <asp:control_name id=“some_id”
runat=“server”/>
VALIDATION CONTROLS
VALIDATION CONTROLS
CUSTOM WEB CONTROLS
 Custom Control are deployed as individual
assemblies. They are complied into Dynamic Link
Library (DLL) and used as any other Asp.net
server control. They could be created in either of
the following way:
 By deriving a custom control from an existing
control.
 By composing a new custom control combing two
or more existing controls.
 By deriving from the base control class.
CUSTOM WEB CONTROLS

More Related Content

What's hot

C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
sharqiyem
 
C sharp
C sharpC sharp
C sharp
sanjay joshi
 
Introduction to Object Oriented databases
Introduction to Object Oriented databasesIntroduction to Object Oriented databases
Introduction to Object Oriented databases
Dr. C.V. Suresh Babu
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
Arun Prasad
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
Abou Bakr Ashraf
 
NoSql
NoSqlNoSql
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
rchakra
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
Jm Ramos
 
Database management systems components
Database management systems componentsDatabase management systems components
Database management systems components
muhammad bilal
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
Syed Hassan Ali
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
Smriti Jain
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
Cuong Ho
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
paradisetechsoftsolutions
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clr
SanSan149
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
Trinath
 

What's hot (20)

C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
 
C sharp
C sharpC sharp
C sharp
 
Introduction to Object Oriented databases
Introduction to Object Oriented databasesIntroduction to Object Oriented databases
Introduction to Object Oriented databases
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
NoSql
NoSqlNoSql
NoSql
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Database management systems components
Database management systems componentsDatabase management systems components
Database management systems components
 
Vb.net ide
Vb.net ideVb.net ide
Vb.net ide
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clr
 
Crystal report
Crystal reportCrystal report
Crystal report
 
C#.NET
C#.NETC#.NET
C#.NET
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
 

Similar to Unit - 1: ASP.NET Basic

Chapter 1
Chapter 1Chapter 1
Bn1001 demo ppt advance dot net
Bn1001 demo ppt advance dot netBn1001 demo ppt advance dot net
Bn1001 demo ppt advance dot net
conline training
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Web techh
Web techhWeb techh
Web techh
SangeethaSasi1
 
Web tech
Web techWeb tech
Web tech
SangeethaSasi1
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
mani bhushan
 
Visual studio
Visual studioVisual studio
Visual studio
anupathak17jul
 
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Top 10 -  ASP.NET Interview Questions And Answers 2023.pdfTop 10 -  ASP.NET Interview Questions And Answers 2023.pdf
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Ruddarpratap
 
Asp.net
Asp.netAsp.net
Asp.net
vijilakshmi51
 
Murach: An introduction to web programming with ASP.NET Core MVC
Murach: An introduction to web programming with ASP.NET Core MVCMurach: An introduction to web programming with ASP.NET Core MVC
Murach: An introduction to web programming with ASP.NET Core MVC
MahmoudOHassouna
 
Beginners introduction to asp.net
Beginners introduction to asp.netBeginners introduction to asp.net
Beginners introduction to asp.net
Naveen Kumar Veligeti
 
Online furniture management system
Online furniture management systemOnline furniture management system
Online furniture management system
Yesu Raj
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checker
Yesu Raj
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
WE-IT TUTORIALS
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
Yesu Raj
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
Yesu Raj
 

Similar to Unit - 1: ASP.NET Basic (20)

Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Bn1001 demo ppt advance dot net
Bn1001 demo ppt advance dot netBn1001 demo ppt advance dot net
Bn1001 demo ppt advance dot net
 
Web tech
Web techWeb tech
Web tech
 
Web tech
Web techWeb tech
Web tech
 
Web techh
Web techhWeb techh
Web techh
 
Web tech
Web techWeb tech
Web tech
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
 
Visual studio
Visual studioVisual studio
Visual studio
 
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Top 10 -  ASP.NET Interview Questions And Answers 2023.pdfTop 10 -  ASP.NET Interview Questions And Answers 2023.pdf
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
 
Asp.net
Asp.netAsp.net
Asp.net
 
Asp.net
Asp.netAsp.net
Asp.net
 
Murach: An introduction to web programming with ASP.NET Core MVC
Murach: An introduction to web programming with ASP.NET Core MVCMurach: An introduction to web programming with ASP.NET Core MVC
Murach: An introduction to web programming with ASP.NET Core MVC
 
Beginners introduction to asp.net
Beginners introduction to asp.netBeginners introduction to asp.net
Beginners introduction to asp.net
 
2310 b 01
2310 b 012310 b 01
2310 b 01
 
2310 b 01
2310 b 012310 b 01
2310 b 01
 
Online furniture management system
Online furniture management systemOnline furniture management system
Online furniture management system
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checker
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 

Unit - 1: ASP.NET Basic

  • 2. Syllabus  UNIT I : ASP.NET Basics  Introduction to ASP.NET: .NET Framework (CLR, CLI, BCL), ASP.NET Basics, ASP.NET Page Structure, Page Life Cycle. Controls: HTML Server Controls, Web Server Controls, Web User Controls, Validation Controls, Custom Web Controls.  UNIT II: Form  Form validation: Client side validation, Server side validation, Validation Controls: Required Field Comparison Range, Calendar Control, Ad rotator Control, Internet Explorer Control. State Management: View State, Control State, Hidden Fields, Cookies, Query Strings, Application State, Session State.
  • 3. Syllabus  UNIT III: ADO.NET  Architecture of ADO .NET, Connected and Disconnected Database, Create Database, Create connection Using ADO.NET Object model, Connection Class, Command Class, Data Adapter Class, Dataset Class, Display data on data bound controls and Data Grid.  UNIT IV: Database accessing  Database accessing on Web Applications: Data Binding Concept with web, Creating Data Grid, Binding standard web server controls, Display data on web form using Data Bound Controls.  UNIT V: XML  Writing Datasets to XML, Reading datasets with XML. WEB services: Remote method call using XML, SOAP, Web service description language, Building and Consuming a web service, Web Application deployment.
  • 4. ASP  ASP—ACTIVE SERVER PAGES  Server side scripting Environment  used to create and run dynamic ,interactive, high- performance web server applications.  Script  Server side  Browser  RequestWeb serverResponsebrowser
  • 5. ASP  Extension– asp.  1.text  2.Html tags  3.Script commands—instructs our computer to do something  Microsoft –webmatrix
  • 6. .NET  .NET is a free, cross-platform ,open source developer platform for building many different types of application.  With .NET, you can use multiple langauage ,editors, and libraries to build for web ,mobile ,desktop ,gaming and iot.  Programming languges – C#,VB,F#  .NET Application create IDE—Visual Studio
  • 7. .NET  .NET support implementation  .NET Core  .Net Framework  .NET framework windows create application.
  • 10. Introduction to ASP.NET  ASP.NET is a web application framework designed and developed by Microsoft. ASP.NET is open source and a subset of the .NET Framework and successor of the classic ASP(Active Server Pages). With version 1.0 of the .NET Framework, it was first released in January 2002. So a question comes to mind that which technology we were using before the year 2002 for developing web applications and services?  Answer is Classic ASP. So before .NET and ASP.NET there was Classic ASP.  ASP.NET is built on the CLR(Common Language Runtime) which allows the programmers to execute its code using any .NET language(C#, VB etc.). It is specially designed to work with HTTP and for web developers to create dynamic web pages, web applications, web sites, and web services as it provides a good integration of HTML, CSS, and JavaScript.  .NET Framework is used to create a variety of applications and services like Console, Web, and Windows, etc. But ASP.NET is only used to create web applications and web services. That’s why we termed ASP.NET as a subset of the
  • 11. What is ASP.Net  ASP.Net is a web development platform provided by Microsoft. It is used for creating web-based applications. ASP.Net was first released in the year 2002.  The first version of ASP.Net deployed was 1.0. The most recent version of ASP.Net is version 4.6. ASP.Net is designed to work with the HTTP protocol. This is the standard protocol used across all web applications.  ASP.Net applications can also be written in a variety of .Net languages. These include C#, VB.Net, and J#. In this chapter, you will see some basic fundamental of the .Net framework.  The full form of ASP is Active Server Pages, and .NET is Network Enabled Technologies.
  • 13. ASP.NET ARCHITECTURE  The architecture of the.Net framework is based on the following key components  Language – A variety of languages exists for .net framework. They are VB.net and C#. These can be used to develop web applications.  Library - The .NET Framework includes a set of standard class libraries. The most common library used for web applications in .net is the Web library. The web library has all the necessary components used to develop.Net web-based applications.  Common Language Runtime - 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
  • 15. COMPONENTS OF .NET FRAMEWORK  Enterprise applications. It mainly contains two components,  1. Common Language Runtime (CLR)  2. .Net Framework Class Library.  Common Language Runtime (CLR) .Net Framework provides runtime environment called Common Language Runtime (CLR).It provides an environment to run all the .Net Programs. The code which runs under the CLR is called as Managed Code. Programmers need not to worry on managing the memory if the programs are running under the CLR as it provides memory management and thread management. Programmatically, when our program needs memory, CLR allocates the memory for scope and de-allocates the memory if the scope is completed. Language Compilers (e.g. C#, VB.Net, J#) will convert the Code/Program to Microsoft Intermediate Language (MSIL) intern this will be converted to Native Code by CLR. See the below Fig.
  • 17. COMPONENTS OF .NET FRAMEWORK  .Net Framework Class Library (FCL) This is also called as Base Class Library and it is common for all types of applications i.e. the way you access the Library Classes and Methods in VB.NET will be the same in C#, and it is common for all other languages in .NET. The following are different types of applications that can make use of .net class library.  1. Windows Application.  2. Console Application  3. Web Application.  4. XML Web Services.  5. Windows Services.
  • 18. COMPONENTS OF .NET FRAMEWORK  Common Type System (CTS) It describes set of data types that can be used in different .Net languages in common. (i.e), CTS ensures that objects written in different .Net languages can interact with each other. For Communicating between programs written in any .NET complaint language, the types have to be compatible on the basic level.  Common Language Specification (CLS) It is a sub set of CTS and it specifies a set of rules that needs to be adhered or satisfied by all language compilers targeting CLR. It helps in cross language inheritance and cross language debugging. Common language specification Rules: It describes the minimal and complete set of features to produce code that can be hosted by CLR. It ensures that products of compilers will work properly in .NET environment.  Sample Rules:  1. Representation of text strings  2. Internal representation of enumerations  3. Definition of static members and this is a subset of the CTS which all .NET languages are expected to support.  4. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.
  • 20. CHARACTERISTICS OF .NET FRAMEWORK  Code Behind Mode – This is the concept of separation of design and code. By making this separation, it becomes easier to maintain the ASP.Net application. The general file type of an ASP.Net file is aspx. Assume we have a web page called MyPage.aspx. There will be another file called MyPage.aspx.cs which would denote the code part of the page. So Visual Studio creates separate files for each web page, one for the design part and the other for the code.  State Management – ASP.Net has the facility to control state management. HTTP is known as a stateless protocol. Let's take an example of a shopping cart application. Now, when a user decides what he wants to buy from the site, he will press the submit button.  The application needs to remember the items the user choose for the purchase. This is known as remembering the state of an application at a current point in time. HTTP is a stateless protocol. When the user goes to the purchase page, HTTP will not store the information on the cart items. Additional coding needs to be done to ensure that the cart items can be carried forward to the purchase page. Such an implementation can become complex at times. But ASP.Net can do state management on your behalf. So ASP.Net can remember the cart items and pass it over to the purchase page.  Caching – ASP.Net can implement the concept of Caching. This improve's the performance of the application. By caching those pages which are often requested by the user can be stored in a temporary location. These pages can be retrieved faster and better responses can be sent to the user. So caching can significantly improve the performance of an application.  ASP.Net is a development language used for constructing web-based applications. ASP.Net is designed to work with the standard HTTP protocol.
  • 22. ASP.Net Lifecycle  1) Application Start - The life cycle of an ASP.NET application starts when a request is made by a user. This request is to the Web server for the ASP.Net Application. This happens when the first user normally goes to the home page for the application for the first time. During this time, there is a method called Application start which is executed by the web server. Usually, in this method, all global variables are set to their default values.  2) Object creation - The next stage is the creation of the Http Context, Http Request & Http Response by the web server. The Http Context is just the container for the Http Request and Http Response objects. The Http Request object contains information about the current request, including cookies and browser information. The Http Response object contains the response that is sent to the client.  3) Http Application creation - This object is created by the web server. It is this object that is used to process each subsequent request sent to the application. For example, let's assume we have 2 web applications. One is a shopping cart application, and the other is a news website. For each application, we would have 2 Http Application objects created. Any further requests to each website would be processed by each Http Application respectively.
  • 23. ASP. Net Lifecycle  4) Dispose - This event is called before the application instance is destroyed. During this time, one can use this method to manually release any unmanaged resources.  5) Application End - This is the final part of the application. In this part, the application is finally unloaded from memory
  • 25. ASP.Net Page Lifecycle  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.  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.  Page Initialization – During this time, all the controls on a web page is initialized. So if you have any label, textbox or any other controls on the web form, they are all initialized.  Page Load – This is when the page is actually loaded with all the default values. So if a textbox is supposed to have a default value, that value is loaded during the page load time.  Validation – Sometimes there can be some validation set on the form. For example, there can be a validation which says that a list box should have a certain set of values. If the condition is false, then there should be an error in loading the page.  Post back event handling – This event is triggered if the same page is being loaded again. This happens in response to an earlier event. Sometimes there can be a situation that a user clicks on a submit button on the page. In this case, the same page is displayed again. In such a case, the Post back event handler is called.  Page Rendering – This happens just before all the response information is sent to the user. All the information on the form is saved, and the result is sent to the user as a complete web page.  Unload – Once the page output is sent to the user, there is no need to keep the ASP.net web form objects in memory. So the unloading process involves removing all unwanted objects from memory.
  • 26. STRUCTURE ASP. NET PAGE  The Structure of an ASP.NET Page  The main components of an ASP.NET page are: • Directives • Code Declaration Blocks • ASP.NET Controls • Code Render Blocks • Server-Side Comments • Server-Side Include Directives • Literal Text and HTML Tags.
  • 27. STRUCTURE ASP. NET PAGE  Directives  A directive controls how the page is compiled. It is marked by the tags, <%@ and %>. It can appear anywhere in a page. But, normally it is placed at the top of a page. The main types of directives are: • Page • Import A Page directive is used to specify the default programming language for a page. <%@ Page Language="C#" %> OR <%@ Language="C#" %> Some namespaces are imported into an ASP.NET page by default. If you wish to use a class that is not contained in the default namespaces, you must import its namespace. <%@ Import Namespace="System.Data.SqlClient" %>
  • 28. STRUCTURE ASP. NET PAGE  Code Declaration Blocks  A code declaration block contains all the application logic for a page. It also includes declarations of global variables, and functions. It must be written within the script runat= "server" tag.  <script runat=”server”>  Protected void page_load(object sender,EventArgs e)  {  //statements  }  Protected void btnAdd_click(object sender,EventArgs e)  {  //statements  }  </script>  The <script> tag has two optional parameters: • Language: You can specify the programming language to be used within the <script> tag. Otherwise, the language specified in the Page directive is used. • SRC: You can specify an external file that contains the code block.
  • 29. STRUCTURE ASP. NET PAGE  Using an external file  <script runat=”server” src=”external file.aspx”/>  <html><head><title>including an external file</title></head>  <form runat=”server”><center>  <asp:label id=”lblmsg” runat=”server”/>  <asp:button id=”btnsubmit” text=”click” onclick=”btnsubmit_click” runat=”server”/>  </center></form></html>  //the external file “externalfile.aspx” is shown below:  Protected void btnsubmit_click(source As object ,E As EventArgs )  {  Lblmsg.text=”HelloWorld”;  }  There is no difference in output between writing the code on the same page and including an external script file.
  • 30. STRUCTURE ASP. NET PAGE  ASP.NET Controls  ASP.NET controls can be mixed with text and static HTML in a page. All controls must appear within a <form runat= "server"> tag. Some controls such as <span runat= "server"> and the Label control can appear outside this tag. You can have only one form per page in ASP.NET.
  • 31. STRUCTURE ASP. NET PAGE  Code Render Blocks  If you wish to execute code within HTML, you can include the code within code render blocks. There are two types of code render blocks: • Inline Code: It executes a statement or series of statements. It is marked by the characters <% and %>. • Inline Expressions: They display the value of a variable or method. They can be considered as shorthand notation for the Response. Write method. They are marked by the characters <%= and %>.  <html>  <head><title>code Render Blocks</title></head>  <%Dim Strvar As String Strvar=”this is a test variable1”%>  <% =strvar%>  <p>  <% Strvar==”this is a test variable2”%>  <% =strvar%>< /html>
  • 32. STRUCTURE ASP. NET PAGE  Server-Side Comments  You can add comments in server-side code using the characters <%-- and --%>. The main use of these comment blocks is to add documentation to a page.  <html>  <head><title>code Render Blocks</title></head>  <%Dim Strvar As String Strvar=”this is a test variable1”%>  <% =strvar%>  <%--------  <p>  <% Strvar==”this is a test variable2”%>  <% =strvar%>  --------%>  < /html>
  • 33. STRUCTURE ASP. NET PAGE  Server-Side Include Directives  You can include a file in an ASP.NET page by using a server-side include directive. It is executed before any of the code in the page. If the file is in the same directory or in a sub-directory of the page including the file, this directive is written as: <!-- #INCLUDE file="includedfile.aspx" --> You can also specify the virtual path of the file. To include a file located in the directory MyAspx under the wwwroot directory, you will write the directive as: <!-- #INCLUDE virtual="/MyAspx/includedfile.aspx" --> Note: It is recommended that you avoid using server-side include directives. It is better to use user controls. 
  • 34. STRUCTURE ASP. NET PAGE  HTML Tags and Literal Text  You can build the static part of an ASP.NET page using HTML tags and literal text. The HTML content of your page is also compiled along with the rest of the contents. The literal text has been made bold and converted to uppercase before being rendered in the browser.  <script Runat=”server”>  Protected void page_load(object sender, Eventargs e)  {  foreach(Literal controlICcontrol in page.controls)  {  ICcontrol.text=”<b>”+(ICcontrol.text.Toupper());  }  }  </script>  <html><head><title>Literalcontrolclass</title></head>  <p>this is some literal text </html>  Output  THIS IS SOME LITERAL TEXT
  • 35. ASP.NET – SERVER CONTROLS
  • 36. SERVER CONTROL Asp.net server controls are the primary controls used in Asp.net. These controls can be grouped into following categories There are three kinds of server controls  Html Server Controls-traditional HTML Tags  Web Server Controls-New Asp.net tags  Validation Server Controls-For input validation
  • 37. HTML SERVER CONTROLS  HTML server controls are Html tags understood by the server .  HTML elements in ASP.NET files are by default, treated as text .to make these elements programmable ,add a runat=“server” attributes to the html element. The attributes indicates that the element should be treated as a server control.  The SYSTEM.WEB.UI.HTMLCONTROLS.HTMLCON TROL base class contains all of the common properties.html server derive from this class.
  • 39. WEB SERVER CONTROLS  Web server controls are special asp.net tags understood by the server.  Like html server controls, web server controls are also created on the server and they require a runat=“server” attribute to work.  Mostly all web server controls inherit from a common base class ,namely the WEBCONTROL class defined in the System.Web.UI.Webcontrols namespace  The syntax are web server controls <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
  • 40. WEB SERVER CONTROLS  Text box  Button  Literal  Drop Down List Box  Option button and etc.,
  • 41. WEB SERVER CONTROLS – TEXTBOX,BUTTON
  • 57. VALIDATION CONTROLS  Validation controls-These are used to validate user input and they work by running client side script.  Validation server controls are used to validate user- input .If the user-input does not pass validation ,it will display an error message to the user.  Each validation control performs a specific type of validation (like validating against a specific value or a range value).
  • 58. VALIDATION CONTROLS  The syntax for creating a validation server control is:  <asp:control_name id=“some_id” runat=“server”/>
  • 61. CUSTOM WEB CONTROLS  Custom Control are deployed as individual assemblies. They are complied into Dynamic Link Library (DLL) and used as any other Asp.net server control. They could be created in either of the following way:  By deriving a custom control from an existing control.  By composing a new custom control combing two or more existing controls.  By deriving from the base control class.