Copyright 2021 by Virtual Assets. ASP.NET Content https ...

23
ASP.NET Content © Copyright 2021 by Virtual Assets. https://virtualassets.in/ © Copyright 2020 by Virtual Assets. https://virtualassets.in/ About the Tutorial ASP.NET is a web application framework developed by Microsoft to Creat dynamic web sites. It allows you to use a full-featured programming language such as C# or VB.NET to build web applications easily. This tutorial covers all the basic and advance level of ASP.NET topics that will be useful to create asp.net dynamic web sites. Audience This tutorial is prepared for the beginners as well as experience to help them understand basic and advance level of ASP.NET programming. In this tutorial we will cover all of the topic which comes under asp.net programing language form basic level to advance level. After completing this tutorial, we will work on live project and after completion of live project we will have a presentation on project and based on that will have a Q&A session. After completion of project we will see asp.net interview question so it will be helpful at the time of interview. Prerequisites Before proceeding with this tutorial, we should have a basic knowledge of .NET programming language like C# or vb.net. As we are going to work with asp.net so it will be good if have basic knowledge on client-side application such as HTML, jQuery, JavaScript, CSS, AJAX, etc. Note: We will get the basic understanding on the technologies which required to create a dynamic asp.net website as per this tutorial. Disclaimer &Copyright Copyright 2021 by Virtual Assets.

Transcript of Copyright 2021 by Virtual Assets. ASP.NET Content https ...

Page 1: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

About the Tutorial

ASP.NET is a web application framework developed by Microsoft to Creat

dynamic web sites. It allows you to use a full-featured programming

language such as C# or VB.NET to build web applications easily.

This tutorial covers all the basic and advance level of ASP.NET topics that

will be useful to create asp.net dynamic web sites.

Audience

This tutorial is prepared for the beginners as well as experience to help them

understand basic and advance level of ASP.NET programming. In this

tutorial we will cover all of the topic which comes under asp.net programing

language form basic level to advance level. After completing this tutorial,

we will work on live project and after completion of live project we will have

a presentation on project and based on that will have a Q&A session.

After completion of project we will see asp.net interview question so it will

be helpful at the time of interview.

Prerequisites

Before proceeding with this tutorial, we should have a basic knowledge of

.NET programming language like C# or vb.net. As we are going to work

with asp.net so it will be good if have basic knowledge on client-side

application such as HTML, jQuery, JavaScript, CSS, AJAX, etc.

Note: We will get the basic understanding on the technologies which

required to create a dynamic asp.net website as per this tutorial.

Disclaimer & Copyright

Copyright 2021 by Virtual Assets.

Page 2: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Contents

About the Tutorial .........................................................

Audience .....................................................................

Prerequisites ................................................................

Disclaimer & Copyright ..................................................

Contents......................................................................

1. INTRODUCTION ................................................................

What is ASP.NET? .........................................................

ASP.Net Architecture and Component…………………………………

ASP.NET Web Forms Model ............................................

What is server side and Client-Side technology .................

.Net Framework ...........................................................

What is C# and vb.net……………………………………………………

2. ENVIRONMENT SETUP ......................................................

Installing The Visual Studio ...........................................

Creating a sample Projects ............................................

Building and Running a Project .......................................

Asp.net project folder structure knowledge……………………..

3. LIFE CYCLE ................................................................................

ASP.NET Application Life Cycle .......................................

ASP.NET Page Life Cycle ................................................

ASP.NET Page Life Cycle Events ......................................

Debugging knowledge …………………………………………………….

Page 3: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

4. Basic knowledge on client-side application…………

5. Basic knowledge on C# and Oops……………………….

6. Asp.net First application .......................................................

Adding control to project and checking the behavior of

website…………….

7. Knowledge on IIS Server

Basic understanding on IIS

Run asp.net application on IIS

8. Understanding on different type of control provide by

asp.net framework

Button Controls ............................................................

Text Boxes and Labels ...................................................

Check Boxes and Radio Buttons ......................................

List Controls .................................................................

The ListItemCollection Object .........................................

Radio Button list and Check Box List ...............................

Bulleted lists and Numbered Lists ...................................

HyperLink Control .........................................................

Image Control ..............................................................

9. SERVER CONTROLS ................................................................

Properties of the Server Controls ....................................

Methods of the Server Controls ......................................

10. VALIDATORS .....................................................................

BaseValidator Class .......................................................

Page 4: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

RequiredFieldValidator Control .......................................

RangeValidator Control ..................................................

CompareValidator Control ..............................................

RegularExpressionValidator ............................................

CustomValidator ...........................................................

ValidationSummary .......................................................

Validation Groups .........................................................

11. Session management technique in Asp.net

Session………………………………………………………………………

Cookies……………………………………………………………………..

Query String……………………………………………………………..

View state ……………………………………………………………….

Application state…………………………………………………………..

12. EVENT HANDLING in asp.net ............................................

Event Arguments ..........................................................

Application and Session Events .......................................

Page and Control Events ................................................

Event Handling Using Controls ........................................

Default Events ..............................................................

13. CLIENT SIDE coding for asp.net controls .............................

Client Side Scripts ........................................................

Client Side Source Code ................................................

14. DIRECTIVES ......................................................................

The Application Directive ...............................................

Page 5: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

The Assembly Directive .................................................

The Control Directive ....................................................

The Implements Directive ..............................................

The Import Directive .....................................................

The Master Directive .....................................................

The MasterType Directive ..............................................

The OutputCache Directive ............................................

The Page Directive ........................................................

The PreviousPageType Directive .....................................

The Reference Directive .................................................

The Register Directive ...................................................

15. DATABASE ............................................................................

Installation SQL server ..................................................

Basic knowledge on sql server………………………………………

Database query on sql server

16. ADO.NET ...........................................................................

The DataSet Class ........................................................

The DataTable Class ......................................................

The DataRow Class .......................................................

The DataAdapter Object ................................................

The DataReader Object .................................................

DbCommand and DbConnection Objects ..........................

17. DATA SOURCES .................................................................

Data Source Views ........................................................

Page 6: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

The SqlDataSource Control ............................................

The ObjectDataSource Control........................................

The AccessDataSource Control .......................................

18. DATA BINDING ...............................................................

Simple Data Binding ......................................................

Declarative Data Binding ...............................................

19. Asp.net GridView…………………………………………….

Basic Gridview knowledge……………………………………………….

Nested GridView knowledge………………………………………………

Bind Gridview with database…………………………………………..

20. FILE UPLOADING ..............................................................

21. AD ROTATORS ........................................................................

The Advertisement File ..................................................

Properties and Events of the AdRotator Class ...................

Working with AdRotator Control ......................................

22. CALENDARS ......................................................................

Properties and Events of the Calendar Control ..................

Working with the Calendar Control ..................................

23. MULTI VIEWS .................................................................

Properties of View and MultiView Controls ........................

24. PANEL CONTROLS ..................................................................

Working with the Panel Control .......................................

25. AJAX CONTROLS ....................................................................

The ScriptManager Control .............................................

Page 7: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

The UpdatePanel Control ...............................................

The UpdateProgress Control ...........................................

The Timer Control .........................................................

26. CUSTOM CONTROLS ...............................................................

User Controls ...............................................................

Custom Controls ...........................................................

Working with Custom Controls .......................................

27. ERROR HANDLING ............................................................

Tracing ........................................................................

Error Handling ..............................................................

28. SECURITY for Website ....................................................

Forms-Based Authentication...........................................

IIS Authentication: SSL .................................................

29. DATA CACHING .................................................................

What is Caching? ..........................................................

Caching in ASP.NET ......................................................

Output Caching ............................................................

Data Caching ...............................................................

Object Caching .............................................................

30. Live project in asp.net dynamic website (Available

with Training)

31. Discussion on live project (Available with Training)

32. Interview question practice. (Available with

Training)

33. Face to Face Interview schedule for student’s

Page 8: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

confidence with interview panel. (Available with Training)

What is Asp.net

ASP.Net is a web Application provided by the Microsoft. It is used for

creating web-based applications. ASP.Net was first released in the year 2002. The full form of ASP is Active Server Pages, and .NET is Network

Enabled Technologies.

ASP.NET application codes can be written in any of the below languages like

• C# • VB.net

• J# • C++

Asp.net is design to work with HTTP protocol. This is the standard

protocol used across all web applications.

ASP.Net Architecture and Component

ASP.Net is a framework which is used to develop the Web application. The

basic architecture of the ASP.Net framework is as shown below.

C# VB J# F# Others

Framework Class Library

Respective class Library

Intermediate Language (IL)

Common Language Runtime (CLR)

OS

Page 9: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

The architecture of the.Net framework is based on the following key

components

1. Library - The .NET Framework includes a set of standard class

libraries. The web library has all the necessary components used to develop.Net web-based applications.

2. Language – .net Framework provide many languages like C#,VB.net F# etc.

3. Common Language Runtime – CLR is used to make Managed code , and manage code is used to take care of garbage collection

in asp.net

ASP.NET Web Forms Model

As per the Asp.net Web Forms Model ,it is used to communicate the data

between data source objects such as ObjectDataSource or SqlDataSource and POCO classes.

What is server side and Client-Side technology

In ASP.NET, server-side code uses the. NET Framework and is written in languages like C# and VB.NET. Server-side processing is used to interact

with permanent storage like databases or files.

.Net Framework

NET Framework is used to create and run software applications. . NET apps can run on many operating systems, using different implementations

of. NET, dot NET Framework is used for running.

What is C# and vb.net

C# and VB.NET are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Both Visual

Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual

C# .NET. Visual C# .NET may have a few more "power" features such as handling unmanaged code, and Visual Basic .NET may be skewed a little

toward ease of use by providing features such as late binding..So in terms of what lanuage to use then i would suggest you to choose the language

that you are most comfortable with or it would be better if you will start leaning both.

Page 10: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Installing The Visual Studio

1. Step 1 - Make sure your computer is ready for Visual Studio.

2. Step 2 - Download Visual Studio.

3. Step 3 - Install the Visual Studio installer.

4. Step 4 - Choose workloads.

5. Step 5 - Choose individual components (Optional)

6. Step 6 - Install language packs (Optional)

You can download the software and follow the process.

https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2019

Creating a sample Project

1. To Create a asp.net application, 1st open the visual studio 2019 and then in right side click on “create a new project”

2. After click on “create a new project, you will see screen like below From here you select Asp.net web application

3. After selecting project give the project name and directory and click

on Create like below image.

Page 11: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

And then select Web Forms and click on Create.

After click on Create you will see asp.net application.

Page 12: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Building and Running a Project For building the asp.net project go to the build option and click on

build solution like below, it will tell your application is have any errors or not.

Create building asp.net application press F5 or click on IIS Express like below.

Page 13: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

After running asp.net application, you will web app on browser like

below.

Asp.net project folder structure knowledge

Page 14: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

App_Start- This folder contains 2 files, one is Bundle Config to manage the script and CSS files and another Route Config to

register the configuration of project.

Content- This folder is used to keep all the necessary CSS files

library.

fonts- This folder is used to keep all the necessary fonts files

library.

Scripts- This folder is used to keep all the necessary Script files

library like jquery.js, bootstrep.js etc

Global.asax:- This file is used to manage the globally session and

from this class we call bundle config and route config files.

Default.aspx:- This is the default page for the application.

Web.config:- In this file we give all the configuration setting

which is available globally like SQL connection.

Page 15: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

ASP.NET Application Life Cycle The life cycle of an ASP.NET application starts when there is a

request is made by a user. When we run application and go to any page of application then this

request is to the Web server for the ASP.Net Application. During this time, there is a method called Application_start from global.asax file

which is executed by the web server. Generally, in this method, all global variables are set to their default values.

ASP.NET Page Life Cycle

When an ASP.Net page is called, it goes through a lifecycle. This is done before the response is sent to the user.

The page life cycle phases are:

• Initialization

• Instantiation of the controls on the page

• Maintain of the state

• Execution of the event handler codes

• Page rendering

Page request → Page Start → Page Initialization → Page Load →

Validation → Postback event handling → Page Rendering → Unload

ASP.NET Page Life Cycle Events

• PreInit: Setting a master page or setting the Theme property.

• Init: Read or set control properties. • Load: Set properties of controls and to establish database

connections. • Control events: Handle specific control events. We can bind

control events either in code or declaratively using attributes. • Render: This is mostly used for custom controls to generate the

control's output. • Unload: Final cleanup for controls like closing database

connections.

Knowledge on IIS Server

IIS stands for Internet Information Services. Formerly known as Internet Information Server, IIS is a Web Server or a Windows

component that accepts requests from Client browser and responds with the requested page(s). It is an extensible web server that

supports HTTP, HTTPS, FTP, FTPS, SMTP, & NNTP protocols.

Page 16: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Hosting application on IIS/ Run application On IIS

For hosting a website in IIS follow the below steps:-

1. Type inetmgr as shown in the below screenshot.

2. Right click on IIS Manager & click “Run as Administrator” below

screen will appear.

3. Right click on sites present in left side of the windows pane & Select “Add Web Site” as shown in the below screenshot.

Page 17: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

4. On clicking “Add Website” below screen will appear,

5. Give the site name, physical path, host name & click ok as shown in

the below screenshot,

Page 18: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

6. Mysite will appear on the left pane of the window

7. Right click on website name & Go to “Manage Web Site” & select

“Browse” as shown in the below screenshot,

Different Type of control available in asp.net

Asp.net provide different type of controls to design a good dynamic

web application.

We can customize the controls as per our requirement.

For understanding details on every control, you can Enroll and take

the Web Session from below URL

https://virtualassets.in/

VALIDATORS

Validation is very important for an application to restrict unwanted data

to our application , asp.net provide many inbuild validation like

RequireFieldValidation, EmaiCheckValidation etc.

Apart from it we can customize the validation as well.

For understanding details on every validation, you can Enroll and

take the Web Session from below URL

https://virtualassets.in/

DIRECTIVES

Page 19: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Directives specify settings that are used by the page and user-

control compilers when the compilers process ASP.NET Web Forms

pages (.aspx files) and user control (.ascx) files.

There are many Directive available in asp.net application

The Application Directive

The Assembly Directive

The Control Directive

The Implements Directive

The Import Directive

The Master Directive

The MasterType Directive

The OutputCache Directive

The Page Directive

The PreviousPageType Directive

The Reference Directive

The Register Directive

For understanding details on every directive, you can Enroll and

take the Web Session from below URL

https://virtualassets.in/

State management technique in Asp.net

Client-Side state management

View State:- View State can be used to maintain the State at a page level. It store in the Hidden field.

Cookies: - ASP.Net provides another way of state management, which is by using Cookies. When the user sends a request to the

server, the server creates a cookie and attaches a header and sends it back to the user along with the response. The browser accepts

the cookie and stores it at a specific location on the client's machine.

There are 2 ways of assigning / storing values in cookies.

Page 20: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

1. Using the Request Object

Here I have made use of the Request object. The Cookies property of the HTTPResponse Object and the HTTPRequest Object can be

used to assign values to the Cookies Collection and get values back from the Collection. We can also store multiple values in a cookie.

2. Using the HTTPCookies Object

Query string:- A Query String is a string which is appended to the end of the Page URL. It is very simple to use and can be used to

send data across pages. It stores information in a key - value pair. A "?"

signature is used to append the key and value to the page URL.

Way to pass a value using Query String

Way to read Query String value

Page 21: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Server Side State Management Application State

1. If the information that we want to be accessed or stored globally

throughout the application, even if multiple users access the site or application at the same time, then we can use an Application Object

for such purposes. 2. It stores information as a Dictionary Collection in key - value pairs.

This value is accessible across the pages of the application /

website. 3. There are 3 events of the Application which are as follows

o Application_Start o Application_Error

o Application_End

o

Session State

For each and every user, a separate Session is created, and each and every Session has its Unique ID. This ID is being stored in the

client's machine using cookies.

ADO.net

ADO.NET stands for ActiveX Data Object is a database access technology created by Microsoft as part of its .NET framework that can access any

kind of data source. ADO .NET uses SQL queries and stored procedures to read write update

and delete data from a data source. You use SQL queries through ADO.NET Command object, which returns data in the form of DataReader

or DataSet objects. After that connection closes, you use DataSet objects

to work with the data and connect to the data source again when you need to update the data source.

Database in asp.net

To Accessing Data from a database is an important aspect of any

programming language.

ASP.Net is design Is such a way to work with different types of databases.

It can work with the most common databases such as MySQL and

Microsoft SQL Server.

Page 22: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

While working with databases, the following concepts are common across

all databases.

1. Connection – To work with the data in a database, 1st we have to

establish the database then we have to follow below steps 1. Give Database name

2. Give connection string Credentials 2. Selecting data from the database – Once the connection is

established, data is fetched from the database using Ado.net commands then according to our Requirement we can perform

CURD operations means Insert, Delete, update and Get the data

from database.

Database it’s a big subject to understand and in the market, there is huge

demand on Database.

Big Companies works with different type of database such as, SQL server,

MySQL, Oracle, MongoDB.

If you want make career in database or you want to learn Database you

can contact to our site, we provide training for database such as, SQL

server, MySQL, Oracle, MongoDB.

You can do enquire from below link

https://virtualassets.in/contact-us/

If you liked the content of PDF please do like and share with others.

If you want to do training in Microsoft technology like asp.net , MVC ,

asp.net core , Angular , C# you are always invited to contact us from

below link

https://virtualassets.in/contact-us/

Page 23: Copyright 2021 by Virtual Assets. ASP.NET Content https ...

ASP.NET Content © Copyright 2021 by Virtual Assets.

https://virtualassets.in/

© Copyright 2020 by Virtual Assets.

https://virtualassets.in/

Feel free to contact , have a good day 😊