SlideShare a Scribd company logo
Developing Web Applications Using ASP.NET
In this session, you will learn to:
Describe user controls and the underlying enabling
technologies
Create user controls
Describe custom Web server controls and the underlying
enabling technologies
Create Web server controls
Describe composite controls and how composite controls are
created
Create composite Web server controls
Describe templated controls and the interfaces that enable
their implementation
Create templated controls
Objectives
Developing Web Applications Using ASP.NET
A user control usually consists of:
A number of Web Server controls and HTML controls
Methods and properties to control the interaction between
controls included in it
Code to handle the user control events
User controls are created to encapsulate reusable logic for
Web pages in your application.
User controls have the following features:
They are saved as files with a .ascx extension.
They can contain code in the .ascx file or use a code-behind
file.
They do not contain <html>, <body>, or <form> tags.
They have a <%@Control%> directive instead of <$@Page%>
directive.
User Controls
Developing Web Applications Using ASP.NET
They inherit methods and properties from the
System.Web.UI.UserControl class.
They have a user interface, usually made up of Web server
controls and HTML controls.
They can be independently cached for enhanced performance.
A new user control can be added to a page by right-clicking
the Web site folder in Solution Explorer and then selecting
Add New Item.
The user interface for the new control can be designed by
using Design view or Source view.
Event handlers and properties can be written in the
code-behind file.
User Controls (Contd.)
Developing Web Applications Using ASP.NET
If you want to share information between a user control and
a page, you can create public properties for the user control.
A user control can be added to a Web page by performing
the following steps:
Insert a <%@Register%> directive at the top of the page,
underneath the <%@Page%> directive:
<%@Register src=“~/controls/productselector.ascx”
tagprefix=“AdvWorks” tagname=“productselector” %>
Insert the control in to the correct location on the page:
<AdvWorks:productselector id=“productSelector1”
runat=“server” customProperty=“true”/>
User Controls (Contd.)
Developing Web Applications Using ASP.NET
Custom Web server controls provide an approach to reuse
logic in an ASP.NET application.
Custom Web server controls are:
Written entirely by using managed code and have no markup
files.
Derived from System.Web.UI.Control,
System.Web.UI.WebControl, or one of the existing Web
server controls included with ASP.NET.
Compiled into an assembly before deployment of the
application.
Custom Web Server Controls
Developing Web Applications Using ASP.NET
Custom Web server controls are different from User controls
in the following ways:
User controls are easier to create and lay out than Web server
controls because they include markup.
User controls may introduce delays at run time because
controls are not compiled until the page is requested by the
first user.
Custom Web server controls provide better code security than
user controls because they are deployed as compiled
assemblies to the server.
Custom Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
Custom Web server controls are written as classes.
The first step to create a custom Web server control is to
decide the class from which it will be derived.
If the control is very similar to an existing Web server control,
the control can inherit from the Web server control.
If the control will have entirely new functionality, it should
inherit from the Control class.
To modify the HTML that is sent to the browser, you typically
override the Render method.
While creating a custom Web server control, you can use the
App_Code directory to avoid repeated manual compilations.
Once a custom Web server control is created, a developer
can add it to the Toolbox, drag it to the design surface, and
access its properties and events in the property browser.
Custom Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
To add a custom Web Server control to a page, you need to:
1. Use one of the following methods to register the control:
Add a <%@Register%> directive to the Web page:
<% Register tagPrefix=“AdvWorks”
namespace=“AdventureWorks.Controls”%>
Add <controls> tag in the Web.config file:
<system.web>
<pages>
<controls>
<add tagPrefix =“AdvWorks”
namespace=“AdventureWorks.Controls”/>
<controls>
<pages>
<system.web>
Custom Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
2. Add the control to the Web page by including the following
markup at an appropriate position in the page:
<AdvWorks:ProductSelector id=“ProductSelector1
runat=“server”/>
Custom Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
A composite Web server control has the following features:
It has a user interface that is composed of several existing
Web server controls.
It is derived from the
System.WebUI.WebControls.CompositeControl class.
It creates the child control by overriding the
CreateChildControls method.
It is compiled into an assembly in the Bin folder before the
deployment of the application.
Composite Web Server Controls
Developing Web Applications Using ASP.NET
Comparison with Custom Web Server Controls
Like custom Web server controls, a composite Web server
control has no mark up fields and is implemented as a class in
an assembly.
Unlike custom Web server controls, a composite Web server
control is composed almost entirely of a combination of
existing Web server controls.
Composite Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
Composite Web server controls are written as classes.
The creation of composite Web server controls is very
similar to the way in which you create custom Web server
controls.
Composite Web server controls can be compiled into their
own assemblies or added to assemblies with other controls
and classes.
While creating a composite Web server control, you can use
the App_Code directory to avoid repeated manual
compilations.
Composite Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
To add a composite Web server control to a Web page, you
need to:
1. Define a class that derives from
System.Web.UI.WebControls.CompositeControl.
2. Override the Render method of the class and invoke the
RenderControl method of any child control you create.
To add a composite Web server control to a Web page, you
need to:
1. Use one of the following methods to register the control:
Use a <%@register %> directive on the page
Use the <controls> tag in the Web.config file
2. Add the control to the page
Composite Web Server Controls (Contd.)
Developing Web Applications Using ASP.NET
A templated control is a special kind of composite control.
It allows developers to modify the layout of the user
interface by defining their own templates.
A templated control is written in the same manner as a
composite control.
In addition to the tasks performed for creating a composite
control, you need to perform the following tasks to create a
templated control:
Implement one or more properties of the type
System.Web.UI.ITemplate.
Expose a public property of type Sysytem.Web.UI.Control
(or a derived class) to act as the owner of the template.
Templated Controls
Developing Web Applications Using ASP.NET
You can add a templated control to a Web page in the same
manner as a composite control.
You can also specify your own template within the control
tags to display the data as you wish.
Templated Controls (Contd.)
Developing Web Applications Using ASP.NET
Problem Statement:
You are a developer in the Adventure Works organization, a
fictitious bicycle manufacturer. You have been asked to assist
in creating a new Business-to-Consumer (B2C) Web
application and a related Business-to-Employee (B2E) extranet
portal.
Decisions on the design of the application have already been
made. You have been asked to carry out a number of specific
tasks in order to implement various elements of this design. As
part of the first phase of the B2C development, you have been
asked to develop various controls for the Web application.
Demo: Creating Controls for Web Applications
Developing Web Applications Using ASP.NET
Solution:
To solve this problem, you need to perform following tasks:
1. Create User Controls
a. Open the Adventure Works Web site.
b. Add a new user control called SiteCompass to the Web site.
c. Add a label to the SiteCompass user control at design time.
d. Add code to create controls dynamically for the SiteCompass user
control.
e. Add a property to the SiteCompass user control.
f. Add the SiteCompass user control to the TopLevel.master master
page.
g. Test the SiteCompass user control.
Demo: Creating Controls for Web Applications (Contd.)
Developing Web Applications Using ASP.NET
2. Create Web Server Controls
a. Add a class file for the custom Web server control.
b. Add a private method to the custom Web server control class to update
the status displayed to the user.
c. Add an override method for RenderContents method of the Web server
control.
d. Add a public property for the custom Web server control.
e. Write code to add the custom Web server control to the page at run
time.
f. Test the custom Web server control.
3. Create Composite Web Server Controls
a. Modify the custom Web server control to inherit from the Composite
Control class.
b. Declare and add child controls to the ServiceChecker class.
c. Add an event handler for a child control.
d. Render the child control.
e. Test the composite control.
Demo: Creating Controls for Web Applications (Contd.)
Developing Web Applications Using ASP.NET
4. Create Templated Controls
a. Modify the ServiceChecker class to support templates.
b. Define a default template.
c. Implement the template logic.
d. Test the templated control when no template is supplied by the
consumer of the control.
e. Test the templated control when a custom template is supplied by the
consumer of the control.
Demo: Creating Controls for Web Applications (Contd.)
Developing Web Applications Using ASP.NET
In this session, you learned that:
A user control usually consists of a number of Web server
controls and HTML controls, as well as method and properties
to control the interaction between these controls.
A user control can be added to a page by inserting a
<%@Register%> directive at the top of the page and inserting
the control at the correct location.
Custom Web server controls are written entirely by using
managed code and have no markup file.
The class created for custom Web server controls is derived
from existing Web server controls, or the Control class, .or
the WebControl class.
Summary
Developing Web Applications Using ASP.NET
To add a custom Web server control to a page, you need to
first register the control in the Web page or in the Web.config
file.
A composite controls has a user interface that is composed of
several existing Web server controls.
The process of creating and adding a composite Web server
control to a page is similar to the process of adding a custom
Web server control.
A templated control is a composite control, that allows a
developer to change its layout.
Developers can change the layout of a templated control by
defining a template for the control.
Summary (Contd.)

More Related Content

What's hot

ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
Abhishek Sur
 
Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components Workshop
Salesforce Developers
 
Point and Click App Building Workshop
Point and Click App Building WorkshopPoint and Click App Building Workshop
Point and Click App Building Workshop
Salesforce Developers
 
Asp dot net final (2)
Asp dot net   final (2)Asp dot net   final (2)
Asp dot net final (2)
Amelina Ahmeti
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controlsRaed Aldahdooh
 
Salesforce Lightning Components Workshop
Salesforce Lightning Components WorkshopSalesforce Lightning Components Workshop
Salesforce Lightning Components Workshop
Christophe Coenraets
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Digamber Singh
 
Devoxx 09 (Belgium)
Devoxx 09 (Belgium)Devoxx 09 (Belgium)
Devoxx 09 (Belgium)Roger Kitain
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10Sisir Ghosh
 
ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
Randy Connolly
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
parallelminder
 
WAC Widget Upload Process
WAC Widget Upload ProcessWAC Widget Upload Process
WAC Widget Upload Process
wacapps
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
Haining Lee
 
Rails Plugins - Linux For You, March 2011 Issue
Rails Plugins - Linux For You, March 2011 IssueRails Plugins - Linux For You, March 2011 Issue
Rails Plugins - Linux For You, March 2011 Issue
Sagar Arlekar
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
Rajiv Gupta
 

What's hot (20)

ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
 
Lightning Components Workshop
Lightning Components WorkshopLightning Components Workshop
Lightning Components Workshop
 
Point and Click App Building Workshop
Point and Click App Building WorkshopPoint and Click App Building Workshop
Point and Click App Building Workshop
 
Asp dot net final (2)
Asp dot net   final (2)Asp dot net   final (2)
Asp dot net final (2)
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
 
Salesforce Lightning Components Workshop
Salesforce Lightning Components WorkshopSalesforce Lightning Components Workshop
Salesforce Lightning Components Workshop
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
Devoxx 09 (Belgium)
Devoxx 09 (Belgium)Devoxx 09 (Belgium)
Devoxx 09 (Belgium)
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10
 
ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
WAC Widget Upload Process
WAC Widget Upload ProcessWAC Widget Upload Process
WAC Widget Upload Process
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)ActionBarCompat Tutorial-Part 1(Prepare and Setup)
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
 
Rails Plugins - Linux For You, March 2011 Issue
Rails Plugins - Linux For You, March 2011 IssueRails Plugins - Linux For You, March 2011 Issue
Rails Plugins - Linux For You, March 2011 Issue
 
seminar
seminarseminar
seminar
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
 

Viewers also liked

16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
Vivek chan
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10
Vivek chan
 
09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13
Vivek chan
 
08 asp.net session11
08 asp.net session1108 asp.net session11
08 asp.net session11
Vivek chan
 
Net framework session01
Net framework session01Net framework session01
Net framework session01
Vivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
Vivek chan
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20
Vivek chan
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
Vivek chan
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
Vivek chan
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
Vivek chan
 
Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF
Vivek chan
 
Series Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kidsSeries Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kids
Vivek chan
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
Vivek chan
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & Subnetting
Vivek chan
 

Viewers also liked (14)

16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
07 intel v_tune_session_10
07 intel v_tune_session_1007 intel v_tune_session_10
07 intel v_tune_session_10
 
09 intel v_tune_session_13
09 intel v_tune_session_1309 intel v_tune_session_13
09 intel v_tune_session_13
 
08 asp.net session11
08 asp.net session1108 asp.net session11
08 asp.net session11
 
Net framework session01
Net framework session01Net framework session01
Net framework session01
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
14 asp.net session20
14 asp.net session2014 asp.net session20
14 asp.net session20
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
 
Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant Vivek Chan | Technology Consultant
Vivek Chan | Technology Consultant
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
 
Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF Wireless Communication via Mobile Phone Using DTMF
Wireless Communication via Mobile Phone Using DTMF
 
Series Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kidsSeries Parallel Circuit presentation for schools and kids
Series Parallel Circuit presentation for schools and kids
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & Subnetting
 

Similar to 12 asp.net session17

12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17Niit Care
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1Neeraj Mathur
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
Jignesh Aakoliya
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04Niit Care
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
Vivek chan
 
Asp PPT (.NET )
Asp PPT (.NET )Asp PPT (.NET )
Asp PPT (.NET )
Ankit Gupta
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
Vivek chan
 
5a329780735625624 ch10
5a329780735625624 ch105a329780735625624 ch10
5a329780735625624 ch10harkesh singh
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
Akhil Mittal
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Er. Kamal Bhusal
 
Custom controls
Custom controlsCustom controls
Custom controlsaspnet123
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16Niit Care
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
Stefano Paluello
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architectureIblesoft
 
Visualforce report
Visualforce reportVisualforce report
Visualforce report
Rinku Saini
 

Similar to 12 asp.net session17 (20)

12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
Chapter 09
Chapter 09Chapter 09
Chapter 09
 
Asp PPT (.NET )
Asp PPT (.NET )Asp PPT (.NET )
Asp PPT (.NET )
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
 
5a329780735625624 ch10
5a329780735625624 ch105a329780735625624 ch10
5a329780735625624 ch10
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
MVC 4
MVC 4MVC 4
MVC 4
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Custom controls
Custom controlsCustom controls
Custom controls
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
ASP.NET OVERVIEW
ASP.NET OVERVIEWASP.NET OVERVIEW
ASP.NET OVERVIEW
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Session 1
Session 1Session 1
Session 1
 
Visualforce report
Visualforce reportVisualforce report
Visualforce report
 

More from Vivek chan

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdf
Vivek chan
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdf
Vivek chan
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Vivek chan
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Vivek chan
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking drivers
Vivek chan
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using Thoughts
Vivek chan
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Vivek chan
 
Net framework session03
Net framework session03Net framework session03
Net framework session03
Vivek chan
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05
Vivek chan
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04
Vivek chan
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02
Vivek chan
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01
Vivek chan
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02
Vivek chan
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
Vivek chan
 
10 asp.net session14
10 asp.net session1410 asp.net session14
10 asp.net session14
Vivek chan
 
09 asp.net session13
09 asp.net session1309 asp.net session13
09 asp.net session13
Vivek chan
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
Vivek chan
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Vivek chan
 

More from Vivek chan (18)

Deceptive Marketing.pdf
Deceptive Marketing.pdfDeceptive Marketing.pdf
Deceptive Marketing.pdf
 
brain controled wheel chair.pdf
brain controled wheel chair.pdfbrain controled wheel chair.pdf
brain controled wheel chair.pdf
 
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
Mechanism of fullerene synthesis in the ARC REACTOR (Vivek Chan 2013)
 
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
Manav dharma shashtra tatha shashan paddati   munshiram jigyasuManav dharma shashtra tatha shashan paddati   munshiram jigyasu
Manav dharma shashtra tatha shashan paddati munshiram jigyasu
 
Self driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking driversSelf driving and connected cars fooling sensors and tracking drivers
Self driving and connected cars fooling sensors and tracking drivers
 
EEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using ThoughtsEEG Acquisition Device to Control Wheelchair Using Thoughts
EEG Acquisition Device to Control Wheelchair Using Thoughts
 
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
Full Shri Ramcharitmanas in Hindi Complete With Meaning (Ramayana)
 
Net framework session03
Net framework session03Net framework session03
Net framework session03
 
04 intel v_tune_session_05
04 intel v_tune_session_0504 intel v_tune_session_05
04 intel v_tune_session_05
 
03 intel v_tune_session_04
03 intel v_tune_session_0403 intel v_tune_session_04
03 intel v_tune_session_04
 
02 intel v_tune_session_02
02 intel v_tune_session_0202 intel v_tune_session_02
02 intel v_tune_session_02
 
01 intel v_tune_session_01
01 intel v_tune_session_0101 intel v_tune_session_01
01 intel v_tune_session_01
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
10 asp.net session14
10 asp.net session1410 asp.net session14
10 asp.net session14
 
09 asp.net session13
09 asp.net session1309 asp.net session13
09 asp.net session13
 
07 asp.net session10
07 asp.net session1007 asp.net session10
07 asp.net session10
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 

Recently uploaded

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
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
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
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.
 
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
 
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 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
 
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
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
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
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
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
 
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
 
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 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
 
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
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

12 asp.net session17

  • 1. Developing Web Applications Using ASP.NET In this session, you will learn to: Describe user controls and the underlying enabling technologies Create user controls Describe custom Web server controls and the underlying enabling technologies Create Web server controls Describe composite controls and how composite controls are created Create composite Web server controls Describe templated controls and the interfaces that enable their implementation Create templated controls Objectives
  • 2. Developing Web Applications Using ASP.NET A user control usually consists of: A number of Web Server controls and HTML controls Methods and properties to control the interaction between controls included in it Code to handle the user control events User controls are created to encapsulate reusable logic for Web pages in your application. User controls have the following features: They are saved as files with a .ascx extension. They can contain code in the .ascx file or use a code-behind file. They do not contain <html>, <body>, or <form> tags. They have a <%@Control%> directive instead of <$@Page%> directive. User Controls
  • 3. Developing Web Applications Using ASP.NET They inherit methods and properties from the System.Web.UI.UserControl class. They have a user interface, usually made up of Web server controls and HTML controls. They can be independently cached for enhanced performance. A new user control can be added to a page by right-clicking the Web site folder in Solution Explorer and then selecting Add New Item. The user interface for the new control can be designed by using Design view or Source view. Event handlers and properties can be written in the code-behind file. User Controls (Contd.)
  • 4. Developing Web Applications Using ASP.NET If you want to share information between a user control and a page, you can create public properties for the user control. A user control can be added to a Web page by performing the following steps: Insert a <%@Register%> directive at the top of the page, underneath the <%@Page%> directive: <%@Register src=“~/controls/productselector.ascx” tagprefix=“AdvWorks” tagname=“productselector” %> Insert the control in to the correct location on the page: <AdvWorks:productselector id=“productSelector1” runat=“server” customProperty=“true”/> User Controls (Contd.)
  • 5. Developing Web Applications Using ASP.NET Custom Web server controls provide an approach to reuse logic in an ASP.NET application. Custom Web server controls are: Written entirely by using managed code and have no markup files. Derived from System.Web.UI.Control, System.Web.UI.WebControl, or one of the existing Web server controls included with ASP.NET. Compiled into an assembly before deployment of the application. Custom Web Server Controls
  • 6. Developing Web Applications Using ASP.NET Custom Web server controls are different from User controls in the following ways: User controls are easier to create and lay out than Web server controls because they include markup. User controls may introduce delays at run time because controls are not compiled until the page is requested by the first user. Custom Web server controls provide better code security than user controls because they are deployed as compiled assemblies to the server. Custom Web Server Controls (Contd.)
  • 7. Developing Web Applications Using ASP.NET Custom Web server controls are written as classes. The first step to create a custom Web server control is to decide the class from which it will be derived. If the control is very similar to an existing Web server control, the control can inherit from the Web server control. If the control will have entirely new functionality, it should inherit from the Control class. To modify the HTML that is sent to the browser, you typically override the Render method. While creating a custom Web server control, you can use the App_Code directory to avoid repeated manual compilations. Once a custom Web server control is created, a developer can add it to the Toolbox, drag it to the design surface, and access its properties and events in the property browser. Custom Web Server Controls (Contd.)
  • 8. Developing Web Applications Using ASP.NET To add a custom Web Server control to a page, you need to: 1. Use one of the following methods to register the control: Add a <%@Register%> directive to the Web page: <% Register tagPrefix=“AdvWorks” namespace=“AdventureWorks.Controls”%> Add <controls> tag in the Web.config file: <system.web> <pages> <controls> <add tagPrefix =“AdvWorks” namespace=“AdventureWorks.Controls”/> <controls> <pages> <system.web> Custom Web Server Controls (Contd.)
  • 9. Developing Web Applications Using ASP.NET 2. Add the control to the Web page by including the following markup at an appropriate position in the page: <AdvWorks:ProductSelector id=“ProductSelector1 runat=“server”/> Custom Web Server Controls (Contd.)
  • 10. Developing Web Applications Using ASP.NET A composite Web server control has the following features: It has a user interface that is composed of several existing Web server controls. It is derived from the System.WebUI.WebControls.CompositeControl class. It creates the child control by overriding the CreateChildControls method. It is compiled into an assembly in the Bin folder before the deployment of the application. Composite Web Server Controls
  • 11. Developing Web Applications Using ASP.NET Comparison with Custom Web Server Controls Like custom Web server controls, a composite Web server control has no mark up fields and is implemented as a class in an assembly. Unlike custom Web server controls, a composite Web server control is composed almost entirely of a combination of existing Web server controls. Composite Web Server Controls (Contd.)
  • 12. Developing Web Applications Using ASP.NET Composite Web server controls are written as classes. The creation of composite Web server controls is very similar to the way in which you create custom Web server controls. Composite Web server controls can be compiled into their own assemblies or added to assemblies with other controls and classes. While creating a composite Web server control, you can use the App_Code directory to avoid repeated manual compilations. Composite Web Server Controls (Contd.)
  • 13. Developing Web Applications Using ASP.NET To add a composite Web server control to a Web page, you need to: 1. Define a class that derives from System.Web.UI.WebControls.CompositeControl. 2. Override the Render method of the class and invoke the RenderControl method of any child control you create. To add a composite Web server control to a Web page, you need to: 1. Use one of the following methods to register the control: Use a <%@register %> directive on the page Use the <controls> tag in the Web.config file 2. Add the control to the page Composite Web Server Controls (Contd.)
  • 14. Developing Web Applications Using ASP.NET A templated control is a special kind of composite control. It allows developers to modify the layout of the user interface by defining their own templates. A templated control is written in the same manner as a composite control. In addition to the tasks performed for creating a composite control, you need to perform the following tasks to create a templated control: Implement one or more properties of the type System.Web.UI.ITemplate. Expose a public property of type Sysytem.Web.UI.Control (or a derived class) to act as the owner of the template. Templated Controls
  • 15. Developing Web Applications Using ASP.NET You can add a templated control to a Web page in the same manner as a composite control. You can also specify your own template within the control tags to display the data as you wish. Templated Controls (Contd.)
  • 16. Developing Web Applications Using ASP.NET Problem Statement: You are a developer in the Adventure Works organization, a fictitious bicycle manufacturer. You have been asked to assist in creating a new Business-to-Consumer (B2C) Web application and a related Business-to-Employee (B2E) extranet portal. Decisions on the design of the application have already been made. You have been asked to carry out a number of specific tasks in order to implement various elements of this design. As part of the first phase of the B2C development, you have been asked to develop various controls for the Web application. Demo: Creating Controls for Web Applications
  • 17. Developing Web Applications Using ASP.NET Solution: To solve this problem, you need to perform following tasks: 1. Create User Controls a. Open the Adventure Works Web site. b. Add a new user control called SiteCompass to the Web site. c. Add a label to the SiteCompass user control at design time. d. Add code to create controls dynamically for the SiteCompass user control. e. Add a property to the SiteCompass user control. f. Add the SiteCompass user control to the TopLevel.master master page. g. Test the SiteCompass user control. Demo: Creating Controls for Web Applications (Contd.)
  • 18. Developing Web Applications Using ASP.NET 2. Create Web Server Controls a. Add a class file for the custom Web server control. b. Add a private method to the custom Web server control class to update the status displayed to the user. c. Add an override method for RenderContents method of the Web server control. d. Add a public property for the custom Web server control. e. Write code to add the custom Web server control to the page at run time. f. Test the custom Web server control. 3. Create Composite Web Server Controls a. Modify the custom Web server control to inherit from the Composite Control class. b. Declare and add child controls to the ServiceChecker class. c. Add an event handler for a child control. d. Render the child control. e. Test the composite control. Demo: Creating Controls for Web Applications (Contd.)
  • 19. Developing Web Applications Using ASP.NET 4. Create Templated Controls a. Modify the ServiceChecker class to support templates. b. Define a default template. c. Implement the template logic. d. Test the templated control when no template is supplied by the consumer of the control. e. Test the templated control when a custom template is supplied by the consumer of the control. Demo: Creating Controls for Web Applications (Contd.)
  • 20. Developing Web Applications Using ASP.NET In this session, you learned that: A user control usually consists of a number of Web server controls and HTML controls, as well as method and properties to control the interaction between these controls. A user control can be added to a page by inserting a <%@Register%> directive at the top of the page and inserting the control at the correct location. Custom Web server controls are written entirely by using managed code and have no markup file. The class created for custom Web server controls is derived from existing Web server controls, or the Control class, .or the WebControl class. Summary
  • 21. Developing Web Applications Using ASP.NET To add a custom Web server control to a page, you need to first register the control in the Web page or in the Web.config file. A composite controls has a user interface that is composed of several existing Web server controls. The process of creating and adding a composite Web server control to a page is similar to the process of adding a custom Web server control. A templated control is a composite control, that allows a developer to change its layout. Developers can change the layout of a templated control by defining a template for the control. Summary (Contd.)