of 34
8/14/2019 ASPdotNET Presentation Part1
1/34
Softsmith Infotech
.Net
Table of contents Introduction to VS 2005 Application and Page Frameworks GUI Controls Validation Server Controls Working with Master Pages Themes & Skins Collections & Lists
Data Binding Data Management with ADO.Net Working with XML Site Navigation Security State Management Caching Debugging & Error Handling File I/O & Streams Configurations
8/14/2019 ASPdotNET Presentation Part1
2/34
8/14/2019 ASPdotNET Presentation Part1
3/34
Softsmith Infotech
What can you find in a VS
We can see these windows when we open
the Visual Studio
Property Window Shows the properties of a
control(Page or button or textbox)
Solution Explorer Shows the files that a
opened project has
Output Window Shows the result of acompilation or execution of a program
Error List Shows the compilation errors etc.
8/14/2019 ASPdotNET Presentation Part1
4/34
Softsmith Infotech
IIS Internet Information Services IIS is a web server that comes along with .Net
We can configure IIS using inetmgr
In the Start Menu, choose Run and type inetmgr. We willget a window that lists the websites present in thesystem.
For creating a virtual directory, right click on the default
website and select New -> Virtual Directory. Give the alias name Give the physical path Give the access permissions and click finish.
8/14/2019 ASPdotNET Presentation Part1
5/34
Softsmith Infotech
ASP .Net
Used to create web applications and web
services that run under IIS
ASP.NET is a collection of .NET classes
that collaborate to process an HTTP
request and generate an HTTP response
Helps us in creating Dynamic Web pages
Dynamic web pages Pages will be
generated at the server based on the usersrequest and then given back to the client
(user)
8/14/2019 ASPdotNET Presentation Part1
6/34
Softsmith Infotech
ASP .Net Framework
ASP.NET is a managed server-side framework For building applications based on HTTP, HTML, XML
and SOAP
ASP.NET relies on IIS for an HTTP entry point
ASP.NET supports building HTML-based WebApplications
Based on ASP.NET pages, Web forms and server-
side controls
ASP.NET supports building Web Services
Based on Web service classes and WebMethods
8/14/2019 ASPdotNET Presentation Part1
7/34
8/14/2019 ASPdotNET Presentation Part1
8/34
Softsmith Infotech
Life cycle of a web application
The Life of web application begins when a user requests
for a page through the browser (client)
When IIS receives request from client it calls ASP. NET
worker process
The ASP.NET worker process loads the assembly
The executable creates an instance of web form
Generates the HTML page to respond to the request
Posts the response to browser and then it destroys the
instance of the web form
Then browser receives the generated HTML
8/14/2019 ASPdotNET Presentation Part1
9/34
Softsmith Infotech
Life cycle of a web application
(Contd..)
Client Performs tasks like button click
The pages data is sent back to server
When server receives this page it createsnew instance of web form
Processes the event occurred
Then again send back HTML and destroys
the page When user stops the web application for a
period of time session ends
8/14/2019 ASPdotNET Presentation Part1
10/34
Softsmith Infotech
ASP .Net Advantages Executable portion of a web application are compiled
Enriched tool support Applications are based on CLR
Common Language Runtime
On the fly updates deployed without restarting server
Better session management
Integration with ADO.NET
Built in features for caching
Create XML Web services
Browser-independent
Language-independent
8/14/2019 ASPdotNET Presentation Part1
11/34
Softsmith Infotech
Application and PageFramework
8/14/2019 ASPdotNET Presentation Part1
12/34
Softsmith Infotech
ASP .Net Applications
Each application is based on IIS virtual
directory
Each application is contained within a
physical directory
Each application runs in its own isolatedAppDomain
Namespace must for this application is
System.Web
8/14/2019 ASPdotNET Presentation Part1
13/34
Softsmith Infotech
ASP .Net Pages
Code and Design are separated
Design file ASPX file
Contains ASPX or HTML tags
Code file called as code behind file Has the programming logic
Programming language can be
C# VB .Net
8/14/2019 ASPdotNET Presentation Part1
14/34
Softsmith Infotech
ASP .Net Pages (Contd..)
ASPX Page has
C# file will have btnSubmit_Click() { ... }
The code behind page is inherited fromSystem.Web.UI.Page class
The .aspx file containing the user interface
is inherited from code behind class
8/14/2019 ASPdotNET Presentation Part1
15/34
Softsmith Infotech
Files in a Web application Project AssemblyInfo.cs
All the information about assembly including version, companyname etc
Default.aspx
The visual description of a Web form.
Default.aspx.cs
The code behind that responds to events on the Web form
Default.aspx.resx
XML resources used by web form
Global.asax
The global events that occur in web applications Web.config
Configuration contents like authentication mode, error files etc.
8/14/2019 ASPdotNET Presentation Part1
16/34
Softsmith Infotech
GUI Controls
8/14/2019 ASPdotNET Presentation Part1
17/34
Softsmith Infotech
Server Control
8/14/2019 ASPdotNET Presentation Part1
18/34
Softsmith Infotech
Web Controls
ListControl
ListBox
CheckBoxList
Button
Table
WebControl
System.Web.UI.Control
System.Object
TextBox
......
8/14/2019 ASPdotNET Presentation Part1
19/34
Softsmith Infotech
Postback event
These events cause the web page to besent back to the server for immediate
processing
When page is posted back ,the Page_Init,Page _Load events are handled
The page is submitted back and renders a
new version of itself back to the user
8/14/2019 ASPdotNET Presentation Part1
20/34
Softsmith Infotech
Validation Controls ASP .Net provides 5 validation controls that are
used to check the validity of data entered by theuser in the server controls on the web page. Client side validation is also possible through a
Jscript library WebUIValidation.js Required field validator Regular expression validator Compare validator Range validator Custom validator
Validation summary
8/14/2019 ASPdotNET Presentation Part1
21/34
Softsmith Infotech
Required Field Validator To check whether a control contains data
Properties:
ControlToValidate
ErrorMessage
Text
Method:
Validate
8/14/2019 ASPdotNET Presentation Part1
22/34
Softsmith Infotech
Regular Expression Validator
To check whether the entered data matches a specific
format
Properties ControlToValidate
ValidationExpression ErrorMessage
Method Validate
8/14/2019 ASPdotNET Presentation Part1
23/34
Softsmith Infotech
Compare Validator
To compare values entered in two controls
Properties:
ControlToCompare
ControlToValidate ErrorMessage
ValueToCompare
Method:
Validate
8/14/2019 ASPdotNET Presentation Part1
24/34
Softsmith Infotech
Range Validator
To compare whether the entered value is
between two specified values
Properties: ControlToValidate
ErrorMessage Type MaximumValue MinimumValue
Method: Validate
8/14/2019 ASPdotNET Presentation Part1
25/34
Softsmith Infotech
Custom Validator
To Check the validity of an entered item using aclient-side script or a server-side code, or both
Properties:
ControlToValidate ErrorMessage
Events: ServerValidate
Method: OnServerValidate
Validate
8/14/2019 ASPdotNET Presentation Part1
26/34
Softsmith Infotech
Validation Summary
To Display validation errors in a central location ordisplay a general validation error description
Properties:
HeadText ShowMessageBox
ShowSummary
8/14/2019 ASPdotNET Presentation Part1
27/34
Softsmith Infotech
User Controls
We can create our own controls in addition to HTML and Webcontrols
User controls offer you an easy way to partition and reuse commonuser interface (UI) functionality across your ASP.NET Webapplications
User controls are not compiled until run time You can simply drag and drop them on the page and start using
them
To create a user control: Add a new item ( select user control as a template) and give it a name
Heading.ascx
The following description can be seen in HTML view
8/14/2019 ASPdotNET Presentation Part1
28/34
Softsmith Infotech
Using a User Control
To use a user control, just drag the ascx
file from the solution explorer and drop it
on the design area of the aspx page
Or give like this in the html view of the
aspx page In the head portion
Container represents the container for data items
DataFieldname represents the name of data item field