What should you do to convert the Products.aspx page to a user control so that its functionality can be reused on other pages?

Domain.com’s e-Commerce Web application contains a page named Products.aspx that uses data source and data-bound server controls. Customers use the server controls to search for products. The Products.aspx page does not have an associated code-behind file. You need to convert the Products.aspx page to a user control so that its functionality can be reused on other pages.
What should you do?
(Each correct answer presents part of the solution. Choose two.)

Domain.com’s e-Commerce Web application contains a page named Products.aspx that uses data source and data-bound server controls. Customers use the server controls to search for products. The Products.aspx page does not have an associated code-behind file. You need to convert the Products.aspx page to a user control so that its functionality can be reused on other pages.
What should you do?
(Each correct answer presents part of the solution. Choose two.)

A.
Move the Products.aspx page to the App_Code folder.

B.
Create a code-behind file for the Products.aspx page.

C.
Rename the Products.aspx page to Products.ascx.

D.
Remove all server controls from the Products.aspx page.

E.
Replace the Page directive with a Control directive.

Explanation:

There are two things that differentiate a user control from an ASP.NET page: the file extension and the directive. User controls have a .ascx file extension while a page has an .aspx file extension and a page has a Page directive while a user control has a Control directive.

Incorrect Answers:
A: Only code files and files that generate code should be placed in the App_Code folder.
B: User controls do not require a code-behind file.
D: Removing the server controls would also remove the functionality that you want to reuse on other pages.



Leave a Reply 0

Your email address will not be published. Required fields are marked *