17
Developing Web Applications Using ASP.NET In this session, you will learn to: Create connected Web Parts Objectives

16 asp.net session23

Embed Size (px)

Citation preview

Page 1: 16 asp.net session23

Developing Web Applications Using ASP.NET

In this session, you will learn to:Create connected Web Parts

Objectives

Page 2: 16 asp.net session23

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 B2C development, you have been asked to prototype a Web Part Page for employees’ extranet portal.

Demo: Building Web Part Pages and Web Parts

Page 3: 16 asp.net session23

Developing Web Applications Using ASP.NET

Solution:To solve this problem, you need to perform following tasks:

1. Create Connected Web Partsa. 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.

Demo: Building Web Part Pages and Web Parts (Contd.)

Page 4: 16 asp.net session23

Developing Web Applications Using ASP.NET

List the types of Web sites that can be created using Visual Studio 2005.

Test Your Understanding

Answer:Local IIS Web siteFile System Web siteFTP siteRemote Web site

Page 5: 16 asp.net session23

Developing Web Applications Using ASP.NET

What are the levels at which errors can be handled in a Microsoft ASP.NET Web Application?

Test Your Understanding

Answer:Errors in an ASP.NET Web application can be handled at three levels:

At the method level by using Try.. Catch blocksAt the page level by using Page.Error eventAt 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.

Page 6: 16 asp.net session23

Developing Web Applications Using ASP.NET

List the methods that can be used to add Web server controls to Web forms.

Test Your Understanding

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.

Page 7: 16 asp.net session23

Developing Web Applications Using ASP.NET

Which attribute needs to be included in the <%@Page%> directive in a content page that references a master page?

Test Your Understanding

Answer:MasterPageFile

Page 8: 16 asp.net session23

Developing Web Applications Using ASP.NET

List three important events exposed by the Application object.

Test Your Understanding

Answer:Appliaction.StartAppliation.EndApplication.Error

Page 9: 16 asp.net session23

Developing Web Applications Using ASP.NET

What is the basic procedure for displaying data from a relational database on a Web pages?

Test Your Understanding

Answer:To display data from a relational database on a Web page, you need to:

1. Add a data source control to the Web page, and then configure it to connect to the required database.

2. Specify the SELECT statement in the SelectCommand property of the data source control to retrieve the data.

3. Bind data controls or data-aware controls to the data source control.

Page 10: 16 asp.net session23

Developing Web Applications Using ASP.NET

What is the use of the two special values, “*” and “?” in authorization module to control access of a directory in the Web site hierarchy?

Test Your Understanding

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.

Page 11: 16 asp.net session23

Developing Web Applications Using ASP.NET

Which utility enables a user to deploy a compiled Web site without needing to copy the source files?

Test Your Understanding

Answer:The Publish Web Site Utility

Page 12: 16 asp.net session23

Developing Web Applications Using ASP.NET

Which property of the HttpBrowserCapabilities object contains information about the browser that initiated the request?

Test Your Understanding

Answer:Request.Browser

Page 13: 16 asp.net session23

Developing Web Applications Using ASP.NET

Resource files for Implicit localization are stored in the ____________ directory and those for explicit localization are stored in the ____________ directory.

Test Your Understanding

Answer:App_LocalResourcesApp_GlobalResources

Page 14: 16 asp.net session23

Developing Web Applications Using ASP.NET

User controls are saved with an extension of __________ and use the __________ directive instead of the <%@Page %> directive.

Test Your Understanding

Answer:.ascx<%@Control%>

Page 15: 16 asp.net session23

Developing Web Applications Using ASP.NET

How can you cache multiple versions of a page?

Test Your Understanding

Answer:Multiple versions of a page can be cached by using the varybyparam attribute in the <%@OutputCache%> directive.

Page 16: 16 asp.net session23

Developing Web Applications Using ASP.NET

Which event handler can be used to set the ASP.NET theme at run time?

Test Your Understanding

Answer:Page_PreInit

Page 17: 16 asp.net session23

Developing Web Applications Using ASP.NET

List the five standard display modes in the Web parts control set.

Test Your Understanding

Answer:Browse modeDesign modeEdit modeCatalog display modeConnection display mode