Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
16 asp.net session23
1. Developing Web Applications Using ASP.NET
Objectives
In this session, you will learn to:
Create connected Web Parts
Ver. 1.0 Slide 1 of 17
2. Developing Web Applications Using ASP.NET
Demo: Building Web Part Pages and Web Parts
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 B2C development, you have been asked to
prototype a Web Part Page for employees’ extranet portal.
Ver. 1.0 Slide 2 of 17
3. Developing Web Applications Using ASP.NET
Demo: Building Web Part Pages and Web Parts (Contd.)
Solution:
• To solve this problem, you need to perform following tasks:
1. Create Connected Web Parts
a. Add a new class library project to contain the custom Web Part
controls.
b. Add a provider Web Part.
c. Develop the provider Web Part functionality.
d. Define the connection provider method for the Member class.
e. Add a consumer Web Part.
f. Develop the consumer Web Part functionality.
g. Define the connection consumer method for MemberDetails class.
h. Build the control library.
i. Add the controls from the Web Parts library to the Toolbox.
j. Add a ZoneTemplated section to the MainZone area.
k. Add connection information to the WebPartManager control.
l. Run and test the connected Web Parts.
Ver. 1.0 Slide 3 of 17
4. Developing Web Applications Using ASP.NET
Test Your Understanding
List the types of Web sites that can be created using Visual
Studio 2005.
Answer:
Local IIS Web site
File System Web site
FTP site
Remote Web site
Ver. 1.0 Slide 4 of 17
5. Developing Web Applications Using ASP.NET
Test Your Understanding
What are the levels at which errors can be handled in a
Microsoft ASP.NET Web Application?
Answer:
Errors in an ASP.NET Web application can be handled at three
levels:
• At the method level by using Try.. Catch blocks
• At the page level by using Page.Error event
• At the application level by using the web.config file and a
generalized error handling page OR by using the
Application_Error event in global.asax file.
Ver. 1.0 Slide 5 of 17
6. Developing Web Applications Using ASP.NET
Test Your Understanding
List the methods that can be used to add Web server
controls to Web forms.
Answer:
Web server controls can be added to a Web form by:
Dragging and dropping them from the Toolbox on to the Design
view of the Web page.
Dragging and dropping them from the Toolbox into the Source
view of the Web page.
Typing the markup text for the control directly into the Source view
of the Web page.
Ver. 1.0 Slide 6 of 17
7. Developing Web Applications Using ASP.NET
Test Your Understanding
Which attribute needs to be included in the <%@Page%>
directive in a content page that references a master page?
Answer:
MasterPageFile
Ver. 1.0 Slide 7 of 17
8. Developing Web Applications Using ASP.NET
Test Your Understanding
• List three important events exposed by the Application
object.
Answer:
Appliaction.Start
Appliation.End
Application.Error
Ver. 1.0 Slide 8 of 17
9. Developing Web Applications Using ASP.NET
Test Your Understanding
What is the basic procedure for displaying data from a
relational database on a Web pages?
Answer:
To display data from a relational database on a Web page,
you need to:
• Add a data source control to the Web page, and then configure it
to connect to the required database.
• Specify the SELECT statement in the SelectCommand property
of the data source control to retrieve the data.
• Bind data controls or data-aware controls to the data source
control.
Ver. 1.0 Slide 9 of 17
10. Developing Web Applications Using ASP.NET
Test Your Understanding
What is the use of the two special values, “*” and “?” in
authorization module to control access of a directory in the
Web site hierarchy?
Answer:
“*” specifies that the entry applies to everyone who visits a
page in the directory.
“?” specifies that the entry applies to anonymous users who
visit the pages in the directory.
Ver. 1.0 Slide 10 of 17
11. Developing Web Applications Using ASP.NET
Test Your Understanding
Which utility enables a user to deploy a compiled Web site
without needing to copy the source files?
Answer:
The Publish Web Site Utility
Ver. 1.0 Slide 11 of 17
12. Developing Web Applications Using ASP.NET
Test Your Understanding
Which property of the HttpBrowserCapabilities object
contains information about the browser that initiated the
request?
Answer:
Request.Browser
Ver. 1.0 Slide 12 of 17
13. Developing Web Applications Using ASP.NET
Test Your Understanding
Resource files for Implicit localization are stored in the
____________ directory and those for explicit localization
are stored in the ____________ directory.
Answer:
App_LocalResources
App_GlobalResources
Ver. 1.0 Slide 13 of 17
14. Developing Web Applications Using ASP.NET
Test Your Understanding
User controls are saved with an extension of __________
and use the __________ directive instead of the <%@Page
%> directive.
Answer:
.ascx
<%@Control%>
Ver. 1.0 Slide 14 of 17
15. Developing Web Applications Using ASP.NET
Test Your Understanding
How can you cache multiple versions of a page?
Answer:
• Multiple versions of a page can be cached by using the
varybyparam attribute in the <%@OutputCache%> directive.
Ver. 1.0 Slide 15 of 17
16. Developing Web Applications Using ASP.NET
Test Your Understanding
Which event handler can be used to set the ASP.NET
theme at run time?
Answer:
Page_PreInit
Ver. 1.0 Slide 16 of 17
17. Developing Web Applications Using ASP.NET
Test Your Understanding
List the five standard display modes in the Web parts
control set.
Answer:
Browse mode
Design mode
Edit mode
Catalog display mode
Connection display mode
Ver. 1.0 Slide 17 of 17