What code segment should you use?

You are developing a product page named Category.aspx for Web application that will be integrated into Domain.com’s existing e-Commerce Web site. You add a user control named Selector on the Category.aspx page. The user control is implemented in ck_Select.ascx and its code-behind file is ck_Select.ascx.vb. Both ck_Select.ascx and ck_Select.ascx.vb exist in the same application as the Category.aspx page. The assembly associated with the project is named ck_Site.dll. You use the following code to declare the Selection user control on the Category.aspx page:
<ck:Selector ID="_categorySelector" runat="server" SelectorType="Category" /> The register directive for the user control was accidentally deleted from the Category.aspx page. You need to re-register the user control.
What code segment should you use?

You are developing a product page named Category.aspx for Web application that will be integrated into Domain.com’s existing e-Commerce Web site. You add a user control named Selector on the Category.aspx page. The user control is implemented in ck_Select.ascx and its code-behind file is ck_Select.ascx.vb. Both ck_Select.ascx and ck_Select.ascx.vb exist in the same application as the Category.aspx page. The assembly associated with the project is named ck_Site.dll. You use the following code to declare the Selection user control on the Category.aspx page:
<ck:Selector ID="_categorySelector" runat="server" SelectorType="Category" /> The register directive for the user control was accidentally deleted from the Category.aspx page. You need to re-register the user control.
What code segment should you use?

A.
<%@ Register TagName="Selector" Src="ck_Select.ascx" Assembly= "ck_Site" %>

B.
<%@ Register TagName="Selector" TagPrefix="ck" Src="ck_Select.ascx" %>

C.
<%@ Register TagName="Selector" TagPrefix="ck" Assembly= "ck_Site" %>

D.
<%@ Register TagName="Selector" Namespace= "ck_Site" %>

Explanation:

The TagName and TagPrefix attributes identify the user control on the page while the Src attribute specifies the path to the user control.

Incorrect Answers:
A, C, D: The Assembly attribute and namespace attribute are requires when you register a custom Web control. When you register a user control, you need the TagName and TagPrefix attributes, which identify the user control on the page, as well as the Src attribute, which specifies the path to the user control.
B: Convert a Web Forms page to a user control.



Leave a Reply 0

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